Summary Files Commits Branches @commit @diff @stats
path: root / awk-edits / MEL-Presentation.awk
diff options
context:
space:
mode:
1 files changed, 91 insertions, 0 deletions
-rw-r--r--awk-edits/MEL-Presentation.awk91
diff --git a/awk-edits/MEL-Presentation.awk b/awk-edits/MEL-Presentation.awk
new file mode 100644
index 0000000..849a8f8
--- /dev/null
+++ b/awk-edits/MEL-Presentation.awk
@@ -0,0 +1,91 @@
+# .*(slides|teaching)/.*html
+
+BEGIN {
+ #
+ # Elements, dependent (and semidependent) on available font size
+ #
+
+ fontSizes[1] = "18"
+ fontSizes[2] = "20"
+ fontSizes[3] = "22"
+ fontSizes[4] = "25"
+ fontSizes[5] = "27"
+ fontSizes[6] = "35"
+
+ # Certain tags can exist without explicitly defining the font size
+ # while others cannot
+ # fontSizes[0] is used for simpler code for the tags which don't
+ # require font size
+ fontSizes[0] = ""
+
+ # Tags which can exist without specified font-size
+ for (ind in fontSizes) {
+ standardPresentationTag("centered" fontSizes[ind])
+
+ fontClass = (ind != 0) ? " font" fontSizes[ind] : ""
+ MEL["slide" fontSizes[ind], MELOPEN] = "<div id=\"[SLIDEID]\" class=\"slide" fontClass "\">"
+ MEL["slide" fontSizes[ind], MELCLOSE] = "</div>"
+ MEL["vcen" fontSizes[ind], MELOPEN] = "<div id=\"[SLIDEID]\" class=\"slide clide" fontClass "\"><div></div><div>"
+ MEL["vcen" fontSizes[ind], MELCLOSE] = "</div><div></div></div>"
+ MEL["title" fontSizes[ind], MELOPEN] = "<div id=\"[SLIDEID]\" class=\"slide clide centered" fontClass "\"><div></div><div>"
+ MEL["title" fontSizes[ind], MELCLOSE] = "</div><div></div></div>"
+ }
+
+ # refer to definition of fontSizes[0]
+ delete fontSizes[0]
+
+ # Tags which cannot exist without specified font-size
+ for (ind in fontSizes) {
+ standardPresentationTag("font" fontSizes[ind])
+ }
+
+ #
+ # Special cases
+ #
+
+ MEL["presentation", MELSINGLE] = ORS \
+"<nav id=\"presentCont\">" ORS \
+" <span id=\"prevSlideBtn\" class=\"btn nodisplay\">&#x2190;</span>" ORS \
+" <a id=\"slideIndex\" class=\"nodisplay\" href=\"#slide-0\">0</a>" ORS \
+" <span id=\"nextSlideBtn\" class=\"btn nodisplay\">&#x2192;</span>" ORS \
+" <span id=\"articleBtn\" class=\"btn setting-btn\">Article view &#x2632;</span>" ORS \
+" <span id=\"presentBtn\" class=\"btn setting-btn\">Present &#x239A;</span>" ORS \
+" <span id=\"printBtn\" class=\"btn setting-btn\">Print &#x2399;</span>" ORS \
+" </nav><br><br>" ORS \
+" <script type=\"text/javascript\" src=\"/scripts/presentation.js\" crossorigin=\"anonymous\"></script>"
+
+ MEL["rows", MELOPEN] = "<div class=\"layout-table\"><div class=\"layout-row\">" # <table><tr> (layout-row > * is td)
+ MEL["rows", MELCLOSE] = "</div></div>" # </tr><table>
+
+ MEL["eqrows", MELOPEN] = "<div class=\"layout-table fixed-layout\"><div class=\"layout-row\">" # <table><tr> (layout-row > * is td)
+ MEL["eqrows", MELCLOSE] = "</div>"
+
+ MEL["newrow", MELSINGLE] = "</div><div class=\"layout-row\">" # </tr><tr>
+
+ #
+ # Generated tags
+ #
+
+ for (i = 1; i <= 9; i++) {
+ MEL["br" i, MELSINGLE] = "<div class=\"lineb" i "\"></div>"
+ }
+ for (i = 5; i <= 95; i++) {
+ standardPresentationTag("width" i "%")
+ }
+
+ #
+ # Ordinary
+ #
+
+ standardPresentationTag("fright")
+ standardPresentationTag("cont")
+}
+
+function standardPresentationTag(name) {
+ MEL[name, MELOPEN] = "<div class=\"" name "\">"
+ MEL[name, MELCLOSE] = "</div>"
+}
+
+/\[SLIDEID\]/ {
+ sub(/\[SLIDEID\]/, slideIndex++)
+}