Summary Files Commits Branches @commit @diff @stats
path: root / generate-hooks / create-presentation.awk
diff options
context:
space:
mode:
Commit62daf522a1e51c4a1d9d8b31d2a0093da86ebc5d (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-09-28 17:15:36 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-09-29 17:40:09 +0300
Files7474bc314afde18b6e53bb6702f54a04c5a87ed1 /generate-hooks/create-presentation.awk
syndamia.com-62daf522a1e51c4a1d9d8b31d2a0093da86ebc5d.tar
syndamia.com-62daf522a1e51c4a1d9d8b31d2a0093da86ebc5d.tar.gz
syndamia.com-62daf522a1e51c4a1d9d8b31d2a0093da86ebc5d.zip
Parenta8b5c3c03b37ebf90e7ee8c9cb7c8f913f50c79a (diff)
[hooks] Reworked all hooks to use awk for their logic
1 files changed, 45 insertions, 0 deletions
-rw-r--r--generate-hooks/create-presentation.awk45
diff --git a/generate-hooks/create-presentation.awk b/generate-hooks/create-presentation.awk
new file mode 100644
index 0000000..fe10d0b
--- /dev/null
+++ b/generate-hooks/create-presentation.awk
@@ -0,0 +1,45 @@
+BEGIN {
+ pres = ORS \
+"<nav id=\"presentCont\">" ORS \
+" <img id=\"prevSlideBtn\" class=\"unzoomable btn setting-btn icon nodisplay\" src=\"/img/arrow-left-tabler.svg\" alt=\"Previous\">" ORS \
+" <img id=\"nextSlideBtn\" class=\"unzoomable btn setting-btn icon nodisplay\" src=\"/img/arrow-right-tabler.svg\" alt=\"Next\">" ORS \
+" <img id=\"presentBtn\" class=\"unzoomable btn setting-btn icon\" src=\"/img/presentation-tabler.svg\" alt=\"Present\">" ORS \
+" <img id=\"printBtn\" class=\"unzoomable btn setting-btn icon\" src=\"/img/printer-tabler.svg\" alt=\"Print\">" ORS \
+" </nav>" ORS \
+" <script type=\"text/javascript\" src=\"/scripts/presentation.js\" integrity=\"sha512-79MwfB0EQJMdVjVnd3PA0Cn9fo4JaMUmNuyZNEGSbaMEGcqdE8sWWAbMLheaoptDyb/KuYgNw0pKwvR5Dw+lJw==\" crossorigin=\"anonymous\"></script>"
+
+ names[1] = "slide"
+ ended[1] = 1
+ names[2] = "centered"
+ ended[2] = 1
+ names[3] = "flexer"
+ ended[3] = 0
+ names[4] = "fow"
+ ended[4] = 1
+ names[5] = "fol"
+ ended[5] = 1
+ names[6] = "font18"
+ ended[6] = 1
+}
+
+function substitute(ind) {
+ if (ended[ind] == 1) {
+ gsub("<p>&#38;&#38;" names[ind] "</p>", "<div class=\"" names[ind] "\">")
+ gsub("<p>&#38;&#38;&#47;" names[ind] "</p>", "</div>")
+ }
+ else {
+ gsub("<p>&#38;&#38;" names[ind] "</p>", "<div class=\"" names[ind] "\"></div>")
+ }
+}
+
+{
+ gsub("<p>&#38;&#38;presentation</p>", pres)
+ gsub("<p>&#38;&#38;&#47;font</p>", "</div>")
+
+ for (i = 1; i <= length(names); i++) {
+ if (index($0, names[i] "<") != 0)
+ substitute(i)
+ }
+
+ print
+}