From e41ff94d4042870c29c5d5cb70fba6020b18fd0c Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 23 Feb 2024 21:29:56 +0200 Subject: (awk-edits) Added a MEL-based Presentation.awk alternative With slightly modified tag names --- awk-edits/MEL-Presentation.awk | 91 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 awk-edits/MEL-Presentation.awk (limited to 'awk-edits/MEL-Presentation.awk') 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] = "
" + MEL["slide" fontSizes[ind], MELCLOSE] = "
" + MEL["vcen" fontSizes[ind], MELOPEN] = "
" + MEL["vcen" fontSizes[ind], MELCLOSE] = "
" + MEL["title" fontSizes[ind], MELOPEN] = "
" + MEL["title" fontSizes[ind], MELCLOSE] = "
" + } + + # 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 \ +"

" ORS \ +" " + + MEL["rows", MELOPEN] = "
" # (layout-row > * is td) + MEL["rows", MELCLOSE] = "" #
+ + MEL["eqrows", MELOPEN] = "
" #
(layout-row > * is td) + MEL["eqrows", MELCLOSE] = "" + + MEL["newrow", MELSINGLE] = "
" #
+ + # + # Generated tags + # + + for (i = 1; i <= 9; i++) { + MEL["br" i, MELSINGLE] = "
" + } + for (i = 5; i <= 95; i++) { + standardPresentationTag("width" i "%") + } + + # + # Ordinary + # + + standardPresentationTag("fright") + standardPresentationTag("cont") +} + +function standardPresentationTag(name) { + MEL[name, MELOPEN] = "
" + MEL[name, MELCLOSE] = "
" +} + +/\[SLIDEID\]/ { + sub(/\[SLIDEID\]/, slideIndex++) +} -- cgit v1.3.1-26-gb76a From 867b5015fda689bc5414557557a00cd8ad62699d Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 25 Feb 2024 12:51:29 +0200 Subject: (awk-edits) Properly implemented MEL paragraph tag --- awk-edits/MEL-Presentation.awk | 8 +++---- awk-edits/MEL-parser.awk | 53 ++++++++++++++++++++++++++++-------------- 2 files changed, 39 insertions(+), 22 deletions(-) (limited to 'awk-edits/MEL-Presentation.awk') diff --git a/awk-edits/MEL-Presentation.awk b/awk-edits/MEL-Presentation.awk index 849a8f8..7fae51d 100644 --- a/awk-edits/MEL-Presentation.awk +++ b/awk-edits/MEL-Presentation.awk @@ -1,4 +1,4 @@ -# .*(slides|teaching)/.*html +# .*html BEGIN { # @@ -43,7 +43,7 @@ BEGIN { # Special cases # - MEL["presentation", MELSINGLE] = ORS \ + MEL["presentation", MELINSERT] = ORS \ "
(layout-row > * is td) MEL["eqrows", MELCLOSE] = "" - MEL["newrow", MELSINGLE] = "
" #
+ MEL["newrow", MELINSERT] = "
" #
# # Generated tags # for (i = 1; i <= 9; i++) { - MEL["br" i, MELSINGLE] = "
" + MEL["br" i, MELINSERT] = "
" } for (i = 5; i <= 95; i++) { standardPresentationTag("width" i "%") diff --git a/awk-edits/MEL-parser.awk b/awk-edits/MEL-parser.awk index ebd68bd..d1eb4d5 100644 --- a/awk-edits/MEL-parser.awk +++ b/awk-edits/MEL-parser.awk @@ -1,4 +1,4 @@ -# .*(slides|teaching)/.*html +# .*html # # == About == # @@ -29,9 +29,11 @@ BEGIN { newStack("mel") - MELSINGLE = "s" - MELOPEN = "o" - MELCLOSE = "c" + MELOPEN = "o" + MELCLOSE = "c" + MELINSERT = "s" + MELPARAGRAPH = "p" + MELLINE = "l" } // { @@ -42,37 +44,52 @@ BEGIN { melInsideCode = 0 } -melInsideCode == 0 && /^[ \t]*(

)?&/ { +melInsideCode == 0 && /^[ \t]*(

|

)?&[{[()\]}:.]/ { newLine = "" lineCopy = $0 - while (match(lineCopy, /&(((::|[[{(:.])[^[:space:].:[{(<>)}\]&]+)|[\]})])/)) { - RSTART = RSTART + 5 - RLENGTH = RLENGTH - 5 + paragraphed = 0 + while (match(lineCopy, /&(((::|[[{(:.])[^[:space:].:;[{(<>)}\]&]+)|[\]})])/)) { + RSTART += 5 + RLENGTH -= 5 # Inside closing tag if (RLENGTH == 1) { replaceWith = MEL[topStack("mel"), MELCLOSE] popStack("mel") } - # Inside opening tag - else if (substr(lineCopy, RSTART, 1) ~ /[[{(]/) { + # Inside insert + else if (substr(lineCopy, RSTART, 1) == ".") { name = substr(lineCopy, RSTART + 1, RLENGTH - 1) - replaceWith = MEL[name, MELOPEN] - pushStack("mel", name) + replaceWith = MEL[name, MELINSERT] + } + # Inside one line TODO + else if (substr(lineCopy, RSTART, 2) == "::") { + name = substr(lineCopy, RSTART + 2, RLENGTH - 2) + + # RLENGTH = length(lineCopy) + replaceWith = MEL[name, MELLINE] + } + # Inside paragraph + else if (substr(lineCopy, RSTART, 1) == ":") { + name = substr(lineCopy, RSTART + 1, RLENGTH - 1) + + replaceWith = " " MEL[name, MELPARAGRAPH] + RSTART -= 1 + RLENGTH += 1 + paragraphed = 1 } - # Inside paragraph/one line/insert - # TODO: currently all work as insert + # Inside opening tag else { - nameStart = 1 + (substr(lineCopy, RSTART + 1, 1) == ":") - name = substr(lineCopy, RSTART + nameStart, RLENGTH - nameStart) + name = substr(lineCopy, RSTART + 1, RLENGTH - 1) - replaceWith = MEL[name, MELSINGLE] + replaceWith = MEL[name, MELOPEN] + pushStack("mel", name) } newLine = newLine substr(lineCopy, 0, RSTART - 6) replaceWith lineCopy = substr(lineCopy, RSTART + RLENGTH) } $0 = newLine lineCopy - if (length(newLine) > 0) + if (paragraphed == 0 && length(newLine) > 0) gsub(/(

|<\/p>)/, "") } -- cgit v1.3.1-26-gb76a From ab29c6dfd0c640b831e94d56cd3718d4db0dfd0c Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 25 Feb 2024 14:39:00 +0200 Subject: (awk-edits) MEL scripts now require a function so there are no script ordering problems Before if MEL--Parser wasn't put before other MEL files by find command, MEL.... variables wouldn't init and results would be unuseable --- awk-edits/MEL--Parser.awk | 6 +++++- awk-edits/MEL-Iconified.awk | 1 + awk-edits/MEL-Presentation.awk | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'awk-edits/MEL-Presentation.awk') diff --git a/awk-edits/MEL--Parser.awk b/awk-edits/MEL--Parser.awk index d1eb4d5..248eff2 100644 --- a/awk-edits/MEL--Parser.awk +++ b/awk-edits/MEL--Parser.awk @@ -28,10 +28,14 @@ # So it will surf as a separator between direct subelements BEGIN { + usesMEL() newStack("mel") +} + +function usesMEL() { MELOPEN = "o" MELCLOSE = "c" - MELINSERT = "s" + MELINSERT = "i" MELPARAGRAPH = "p" MELLINE = "l" } diff --git a/awk-edits/MEL-Iconified.awk b/awk-edits/MEL-Iconified.awk index 9c7655f..bbe353d 100644 --- a/awk-edits/MEL-Iconified.awk +++ b/awk-edits/MEL-Iconified.awk @@ -1,6 +1,7 @@ # .*html BEGIN { + usesMEL() # # Flags # diff --git a/awk-edits/MEL-Presentation.awk b/awk-edits/MEL-Presentation.awk index 7fae51d..408ef6f 100644 --- a/awk-edits/MEL-Presentation.awk +++ b/awk-edits/MEL-Presentation.awk @@ -1,6 +1,7 @@ # .*html BEGIN { + usesMEL() # # Elements, dependent (and semidependent) on available font size # -- cgit v1.3.1-26-gb76a From 71ecd6d8d554ff23f0161b1c0e447bede9d41377 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 25 Feb 2024 15:38:11 +0200 Subject: (awk-edits/MEL-Presentation) Made file regex less generic --- awk-edits/MEL-Presentation.awk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'awk-edits/MEL-Presentation.awk') diff --git a/awk-edits/MEL-Presentation.awk b/awk-edits/MEL-Presentation.awk index 408ef6f..0fdfabd 100644 --- a/awk-edits/MEL-Presentation.awk +++ b/awk-edits/MEL-Presentation.awk @@ -1,4 +1,4 @@ -# .*html +# .*(slides|teaching)/.*html BEGIN { usesMEL() -- cgit v1.3.1-26-gb76a From 6c1c7ea9ab5cdb1a37c7d75fb85b73bff76dc1ac Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 26 Feb 2024 09:09:59 +0200 Subject: (awk-edits/MEL-Presentation) Renamed vcen to middle, rows to row, sqrows to sqrow and cont to column --- awk-edits/MEL-Presentation.awk | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'awk-edits/MEL-Presentation.awk') diff --git a/awk-edits/MEL-Presentation.awk b/awk-edits/MEL-Presentation.awk index 0fdfabd..2936312 100644 --- a/awk-edits/MEL-Presentation.awk +++ b/awk-edits/MEL-Presentation.awk @@ -26,8 +26,8 @@ BEGIN { fontClass = (ind != 0) ? " font" fontSizes[ind] : "" MEL["slide" fontSizes[ind], MELOPEN] = "

" MEL["slide" fontSizes[ind], MELCLOSE] = "
" - MEL["vcen" fontSizes[ind], MELOPEN] = "
" - MEL["vcen" fontSizes[ind], MELCLOSE] = "
" + MEL["middle" fontSizes[ind], MELOPEN] = "
" + MEL["middle" fontSizes[ind], MELCLOSE] = "
" MEL["title" fontSizes[ind], MELOPEN] = "
" MEL["title" fontSizes[ind], MELCLOSE] = "
" } @@ -55,11 +55,11 @@ BEGIN { "

" ORS \ " " - MEL["rows", MELOPEN] = "
" #
(layout-row > * is td) - MEL["rows", MELCLOSE] = "" #
+ MEL["row", MELOPEN] = "
" #
(layout-row > * is td) + MEL["row", MELCLOSE] = "" #
- MEL["eqrows", MELOPEN] = "
" #
(layout-row > * is td) - MEL["eqrows", MELCLOSE] = "" + MEL["sqrow", MELOPEN] = "
" #
(layout-row > * is td) + MEL["sqrow", MELCLOSE] = "" MEL["newrow", MELINSERT] = "
" #
@@ -79,7 +79,7 @@ BEGIN { # standardPresentationTag("fright") - standardPresentationTag("cont") + standardPresentationTag("column") } function standardPresentationTag(name) { -- cgit v1.3.1-26-gb76a From 7aecc3349ae2f8d47cff60ce7ee2bf03b8432fa5 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 26 Feb 2024 09:11:29 +0200 Subject: (awk-edits/MEL-Presentations) Fixed slide ID format --- awk-edits/MEL-Presentation.awk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'awk-edits/MEL-Presentation.awk') diff --git a/awk-edits/MEL-Presentation.awk b/awk-edits/MEL-Presentation.awk index 2936312..43c60f9 100644 --- a/awk-edits/MEL-Presentation.awk +++ b/awk-edits/MEL-Presentation.awk @@ -88,5 +88,5 @@ function standardPresentationTag(name) { } /\[SLIDEID\]/ { - sub(/\[SLIDEID\]/, slideIndex++) + sub(/\[SLIDEID\]/, "slide-" slideIndex++) } -- cgit v1.3.1-26-gb76a From d2a45f0f1f4f55faac06132714a4b343e0446d21 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 26 Feb 2024 09:12:10 +0200 Subject: (awk-edits/MEL-Presentations) Fixed centered tag not working with font size --- awk-edits/MEL-Presentation.awk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'awk-edits/MEL-Presentation.awk') diff --git a/awk-edits/MEL-Presentation.awk b/awk-edits/MEL-Presentation.awk index 43c60f9..b179502 100644 --- a/awk-edits/MEL-Presentation.awk +++ b/awk-edits/MEL-Presentation.awk @@ -21,15 +21,17 @@ BEGIN { # 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] = "
" MEL["slide" fontSizes[ind], MELCLOSE] = "
" MEL["middle" fontSizes[ind], MELOPEN] = "
" MEL["middle" fontSizes[ind], MELCLOSE] = "
" MEL["title" fontSizes[ind], MELOPEN] = "
" MEL["title" fontSizes[ind], MELCLOSE] = "
" + + MEL["centered" fontSizes[ind], MELOPEN] = "
" + MEL["centered" fontSizes[ind], MELCLOSE] = "
" } # refer to definition of fontSizes[0] -- cgit v1.3.1-26-gb76a From 8d84c03574f122fbac78e5dba083e96bc59dff76 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 26 Feb 2024 09:54:16 +0200 Subject: (awk-edits/MEL-Pres) Renamed certain CSS classes to be more verbose --- awk-edits/MEL-Presentation.awk | 18 +++++----- src/presentation.css | 76 +++++++++++++++++++++--------------------- 2 files changed, 47 insertions(+), 47 deletions(-) (limited to 'awk-edits/MEL-Presentation.awk') diff --git a/awk-edits/MEL-Presentation.awk b/awk-edits/MEL-Presentation.awk index b179502..cabc928 100644 --- a/awk-edits/MEL-Presentation.awk +++ b/awk-edits/MEL-Presentation.awk @@ -25,13 +25,12 @@ BEGIN { MEL["slide" fontSizes[ind], MELOPEN] = "
" MEL["slide" fontSizes[ind], MELCLOSE] = "
" - MEL["middle" fontSizes[ind], MELOPEN] = "
" + MEL["middle" fontSizes[ind], MELOPEN] = "
" MEL["middle" fontSizes[ind], MELCLOSE] = "
" - MEL["title" fontSizes[ind], MELOPEN] = "
" + MEL["title" fontSizes[ind], MELOPEN] = "
" MEL["title" fontSizes[ind], MELCLOSE] = "
" - MEL["centered" fontSizes[ind], MELOPEN] = "
" - MEL["centered" fontSizes[ind], MELCLOSE] = "
" + standardPresentationTag("centered" fontSizes[ind], "centered" fontClass) } # refer to definition of fontSizes[0] @@ -70,22 +69,23 @@ BEGIN { # for (i = 1; i <= 9; i++) { - MEL["br" i, MELINSERT] = "
" + MEL["br" i, MELINSERT] = "
" } for (i = 5; i <= 95; i++) { - standardPresentationTag("width" i "%") + standardPresentationTag("width" i "%", "width" i "per") } # # Ordinary # - standardPresentationTag("fright") + standardPresentationTag("fright", "float-right") standardPresentationTag("column") } -function standardPresentationTag(name) { - MEL[name, MELOPEN] = "
" +function standardPresentationTag(name, class) { + if (class == "") class = name + MEL[name, MELOPEN] = "
" MEL[name, MELCLOSE] = "
" } diff --git a/src/presentation.css b/src/presentation.css index cc82b04..7dbb26a 100644 --- a/src/presentation.css +++ b/src/presentation.css @@ -62,18 +62,18 @@ } .slide .h-anchor, .slide .gap, .slide .gap-small { display: none; } - .clide { display: flex; flex-direction: column; } - .clide > * { flex: 1; } + .centered-slide { display: flex; flex-direction: column; } + .centered-slide > * { flex: 1; } .centered, - .centered .width5, .centered .width10, .centered .width15, .centered .width20, - .centered .width25, .centered .width30, .centered .width35, .centered .width40, - .centered .width45, .centered .width50, .centered .width55, .centered .width60, - .centered .width65, .centered .width70, .centered .width75, .centered .width80, - .centered .width85, .centered .width90, .centered .width95 + .centered .width5per, .centered .width10per, .centered .width15per, .centered .width20per, + .centered .width25per, .centered .width30per, .centered .width35per, .centered .width40per, + .centered .width45per, .centered .width50per, .centered .width55per, .centered .width60per, + .centered .width65per, .centered .width70per, .centered .width75per, .centered .width80per, + .centered .width85per, .centered .width90per, .centered .width95per { margin-left: auto; margin-right: auto; text-align: center; } - .fright { float: right; text-align: right; } - * + .fright { margin-left: 1em; } + .float-right { float: right; text-align: right; } + * + .float-right { margin-left: 1em; } .layout-table { margin: 0; @@ -100,35 +100,35 @@ .font27 { font-size: 27px; } .font35 { font-size: 35px; } - .lineb1 { padding: 0.5em; } - .lineb2 { padding: 1.0em; } - .lineb3 { padding: 1.5em; } - .lineb4 { padding: 2.0em; } - .lineb5 { padding: 2.5em; } - .lineb6 { padding: 3.0em; } - .lineb7 { padding: 3.5em; } - .lineb8 { padding: 4.0em; } - .lineb9 { padding: 4.5em; } - - .width5 { width: 5%; } - .width10 { width: 10%; } - .width15 { width: 15%; } - .width20 { width: 20%; } - .width25 { width: 25%; } - .width30 { width: 30%; } - .width35 { width: 35%; } - .width40 { width: 40%; } - .width45 { width: 45%; } - .width50 { width: 50%; } - .width55 { width: 55%; } - .width60 { width: 60%; } - .width65 { width: 65%; } - .width70 { width: 70%; } - .width75 { width: 75%; } - .width80 { width: 80%; } - .width85 { width: 85%; } - .width90 { width: 90%; } - .width95 { width: 95%; } + .br1 { padding: 0.5em; } + .br2 { padding: 1.0em; } + .br3 { padding: 1.5em; } + .br4 { padding: 2.0em; } + .br5 { padding: 2.5em; } + .br6 { padding: 3.0em; } + .br7 { padding: 3.5em; } + .br8 { padding: 4.0em; } + .br9 { padding: 4.5em; } + + .width5per { width: 5%; } + .width10per { width: 10%; } + .width15per { width: 15%; } + .width20per { width: 20%; } + .width25per { width: 25%; } + .width30per { width: 30%; } + .width35per { width: 35%; } + .width40per { width: 40%; } + .width45per { width: 45%; } + .width50per { width: 50%; } + .width55per { width: 55%; } + .width60per { width: 60%; } + .width65per { width: 65%; } + .width70per { width: 70%; } + .width75per { width: 75%; } + .width80per { width: 80%; } + .width85per { width: 85%; } + .width90per { width: 90%; } + .width95per { width: 95%; } /* Presenting mode -- cgit v1.3.1-26-gb76a