From efa4e784bafeb146dd35ea09f2f481aaedc7e69f Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 23 Feb 2024 21:29:18 +0200 Subject: (awk-edits) Added initial MEL parser --- awk-edits/#stack.awk | 26 ++++++++++++++++ awk-edits/MEL-parser.awk | 78 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 awk-edits/#stack.awk create mode 100644 awk-edits/MEL-parser.awk (limited to 'awk-edits') diff --git a/awk-edits/#stack.awk b/awk-edits/#stack.awk new file mode 100644 index 0000000..a8b0b2a --- /dev/null +++ b/awk-edits/#stack.awk @@ -0,0 +1,26 @@ +function newStack(name) { + __stacks[name, "length"] = 0 +} + +function topStack(name) { + return __stacks[name, __stacks[name, "length"] - 1] +} + +function lengthStack(name) { + return __stacks[name, "length"] +} + +function pushStack(name, value) { + __stacks[name, __stacks[name, "length"]++] = value +} + +function popStack(name, value) { + delete __stacks[name, --__stacks[name, "length"]] +} + +function deleteStack(name) { + for (i = 0; i < __stacks[name, "length"]; i++) { + delete __stacks[name, i] + } + delete __stacks[name, "length"] +} diff --git a/awk-edits/MEL-parser.awk b/awk-edits/MEL-parser.awk new file mode 100644 index 0000000..ebd68bd --- /dev/null +++ b/awk-edits/MEL-parser.awk @@ -0,0 +1,78 @@ +# .*(slides|teaching)/.*html +# +# == About == +# +# MEL is the "Markdown Extensions Language" +# It's a general metalanguage (I made) for adding custom syntax to Markdown (via awk) +# The idea is it provides parsing for general constructs, and you only need to define +# the names of those constructs and with what they get replaced with +# +# Slightly based on ftags, this system allows you to easily implement the following construts: +# &(name ... &) Multiline "tag", everything inside is formatted by "name" +# &{name ... &} In practice, it just replaces "&[name" and "&]" with the appropriate HTML +# &[name ... &] All three can be used interchangeably, though it's preferrable if +# you use the matching braces and semantically, in your "language" +# square brackets are used for the largest components +# curly for structural components and normal braces for styling +# &:name Format/encapsulate everything until the end of the paragraph +# &::name Format/encapsulate everything until the end of the line +# &.name Insert standalone element as-is +# +# Though it's not decided (or implemented) yet, potentially there will also be: +# &)-( Used to simplify cases of &(name1 ... &) &(name1 ... &) &(name1 ... &) +# &}-{ into &(name1 ... &)-( ... &)-( ... &) +# &]-[ Or maybe for special cases, where rather than doing something like +# &{elementsList &(element1 ... &) &(element2 ... &) &} +# you could simply do +# &{elementsList ... &}-{ ... &}-{ ... &} +# So it will surf as a separator between direct subelements + +BEGIN { + newStack("mel") + MELSINGLE = "s" + MELOPEN = "o" + MELCLOSE = "c" +} + +// { + melInsideCode = 1 +} + +/<\/code>/ { + melInsideCode = 0 +} + +melInsideCode == 0 && /^[ \t]*(

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

|<\/p>)/, "") +} -- cgit v1.3.1-26-gb76a 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') 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') 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 125616dd74ee83dbf34a0c862eafeb2ca79560b0 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 25 Feb 2024 12:52:11 +0200 Subject: (awk-edits) Reworked Icons.awk into MEL format --- awk-edits/MEL-Iconified.awk | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 awk-edits/MEL-Iconified.awk (limited to 'awk-edits') diff --git a/awk-edits/MEL-Iconified.awk b/awk-edits/MEL-Iconified.awk new file mode 100644 index 0000000..9c7655f --- /dev/null +++ b/awk-edits/MEL-Iconified.awk @@ -0,0 +1,26 @@ +# .*html + +BEGIN { + # + # Flags + # + + melFlagTag("gb", "ENG") + melFlagTag("bg", "BGN") + + # + # Noteworthy paragraphs + # + + melParTag("question", "dialog-question.png") + melParTag("warn", "dialog-warning.png") + melParTag("important", "dialog-important.png") +} + +function melFlagTag(name, alt) { + MEL[name, MELINSERT] = "\""" +} + +function melParTag(name, image) { + MEL[name, MELPARAGRAPH] = "class=\"special-par " name "-par\">\""" +} -- cgit v1.3.1-26-gb76a From 1105938f1226f419dbf177caa50d2802544bdc8b Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 25 Feb 2024 12:54:51 +0200 Subject: (awk-edits) Renamed mel parser file so it's always before custom mel scripts --- awk-edits/MEL--Parser.awk | 95 +++++++++++++++++++++++++++++++++++++++++++++++ awk-edits/MEL-parser.awk | 95 ----------------------------------------------- 2 files changed, 95 insertions(+), 95 deletions(-) create mode 100644 awk-edits/MEL--Parser.awk delete mode 100644 awk-edits/MEL-parser.awk (limited to 'awk-edits') diff --git a/awk-edits/MEL--Parser.awk b/awk-edits/MEL--Parser.awk new file mode 100644 index 0000000..d1eb4d5 --- /dev/null +++ b/awk-edits/MEL--Parser.awk @@ -0,0 +1,95 @@ +# .*html +# +# == About == +# +# MEL is the "Markdown Extensions Language" +# It's a general metalanguage (I made) for adding custom syntax to Markdown (via awk) +# The idea is it provides parsing for general constructs, and you only need to define +# the names of those constructs and with what they get replaced with +# +# Slightly based on ftags, this system allows you to easily implement the following construts: +# &(name ... &) Multiline "tag", everything inside is formatted by "name" +# &{name ... &} In practice, it just replaces "&[name" and "&]" with the appropriate HTML +# &[name ... &] All three can be used interchangeably, though it's preferrable if +# you use the matching braces and semantically, in your "language" +# square brackets are used for the largest components +# curly for structural components and normal braces for styling +# &:name Format/encapsulate everything until the end of the paragraph +# &::name Format/encapsulate everything until the end of the line +# &.name Insert standalone element as-is +# +# Though it's not decided (or implemented) yet, potentially there will also be: +# &)-( Used to simplify cases of &(name1 ... &) &(name1 ... &) &(name1 ... &) +# &}-{ into &(name1 ... &)-( ... &)-( ... &) +# &]-[ Or maybe for special cases, where rather than doing something like +# &{elementsList &(element1 ... &) &(element2 ... &) &} +# you could simply do +# &{elementsList ... &}-{ ... &}-{ ... &} +# So it will surf as a separator between direct subelements + +BEGIN { + newStack("mel") + MELOPEN = "o" + MELCLOSE = "c" + MELINSERT = "s" + MELPARAGRAPH = "p" + MELLINE = "l" +} + +// { + melInsideCode = 1 +} + +/<\/code>/ { + melInsideCode = 0 +} + +melInsideCode == 0 && /^[ \t]*(

|

)?&[{[()\]}:.]/ { + newLine = "" + lineCopy = $0 + paragraphed = 0 + while (match(lineCopy, /&(((::|[[{(:.])[^[:space:].:;[{(<>)}\]&]+)|[\]})])/)) { + RSTART += 5 + RLENGTH -= 5 + + # Inside closing tag + if (RLENGTH == 1) { + replaceWith = MEL[topStack("mel"), MELCLOSE] + popStack("mel") + } + # Inside insert + else if (substr(lineCopy, RSTART, 1) == ".") { + name = substr(lineCopy, RSTART + 1, RLENGTH - 1) + + 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 opening tag + else { + name = substr(lineCopy, RSTART + 1, RLENGTH - 1) + + replaceWith = MEL[name, MELOPEN] + pushStack("mel", name) + } + newLine = newLine substr(lineCopy, 0, RSTART - 6) replaceWith + lineCopy = substr(lineCopy, RSTART + RLENGTH) + } + $0 = newLine lineCopy + if (paragraphed == 0 && length(newLine) > 0) + gsub(/(

|<\/p>)/, "") +} diff --git a/awk-edits/MEL-parser.awk b/awk-edits/MEL-parser.awk deleted file mode 100644 index d1eb4d5..0000000 --- a/awk-edits/MEL-parser.awk +++ /dev/null @@ -1,95 +0,0 @@ -# .*html -# -# == About == -# -# MEL is the "Markdown Extensions Language" -# It's a general metalanguage (I made) for adding custom syntax to Markdown (via awk) -# The idea is it provides parsing for general constructs, and you only need to define -# the names of those constructs and with what they get replaced with -# -# Slightly based on ftags, this system allows you to easily implement the following construts: -# &(name ... &) Multiline "tag", everything inside is formatted by "name" -# &{name ... &} In practice, it just replaces "&[name" and "&]" with the appropriate HTML -# &[name ... &] All three can be used interchangeably, though it's preferrable if -# you use the matching braces and semantically, in your "language" -# square brackets are used for the largest components -# curly for structural components and normal braces for styling -# &:name Format/encapsulate everything until the end of the paragraph -# &::name Format/encapsulate everything until the end of the line -# &.name Insert standalone element as-is -# -# Though it's not decided (or implemented) yet, potentially there will also be: -# &)-( Used to simplify cases of &(name1 ... &) &(name1 ... &) &(name1 ... &) -# &}-{ into &(name1 ... &)-( ... &)-( ... &) -# &]-[ Or maybe for special cases, where rather than doing something like -# &{elementsList &(element1 ... &) &(element2 ... &) &} -# you could simply do -# &{elementsList ... &}-{ ... &}-{ ... &} -# So it will surf as a separator between direct subelements - -BEGIN { - newStack("mel") - MELOPEN = "o" - MELCLOSE = "c" - MELINSERT = "s" - MELPARAGRAPH = "p" - MELLINE = "l" -} - -// { - melInsideCode = 1 -} - -/<\/code>/ { - melInsideCode = 0 -} - -melInsideCode == 0 && /^[ \t]*(

|

)?&[{[()\]}:.]/ { - newLine = "" - lineCopy = $0 - paragraphed = 0 - while (match(lineCopy, /&(((::|[[{(:.])[^[:space:].:;[{(<>)}\]&]+)|[\]})])/)) { - RSTART += 5 - RLENGTH -= 5 - - # Inside closing tag - if (RLENGTH == 1) { - replaceWith = MEL[topStack("mel"), MELCLOSE] - popStack("mel") - } - # Inside insert - else if (substr(lineCopy, RSTART, 1) == ".") { - name = substr(lineCopy, RSTART + 1, RLENGTH - 1) - - 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 opening tag - else { - name = substr(lineCopy, RSTART + 1, RLENGTH - 1) - - replaceWith = MEL[name, MELOPEN] - pushStack("mel", name) - } - newLine = newLine substr(lineCopy, 0, RSTART - 6) replaceWith - lineCopy = substr(lineCopy, RSTART + RLENGTH) - } - $0 = newLine lineCopy - 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') 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 82d49ec07ee13b5c4726a29a6267b9ee83891b4d Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 25 Feb 2024 14:39:24 +0200 Subject: (awk-edits) Ported File-type.awk to MEL --- awk-edits/MEL-Iconified.awk | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'awk-edits') diff --git a/awk-edits/MEL-Iconified.awk b/awk-edits/MEL-Iconified.awk index bbe353d..332be46 100644 --- a/awk-edits/MEL-Iconified.awk +++ b/awk-edits/MEL-Iconified.awk @@ -16,6 +16,17 @@ BEGIN { melParTag("question", "dialog-question.png") melParTag("warn", "dialog-warning.png") melParTag("important", "dialog-important.png") + + # + # File type + # + + melFiletypeTag("ft-photo", "") + melFiletypeTag("ft-text", "") + melFiletypeTag("ft-zip", "") + melFiletypeTag("ft-movie", "") + melFiletypeTag("ft-markdown", "") + melFiletypeTag("ft-browser", "") } function melFlagTag(name, alt) { @@ -25,3 +36,7 @@ function melFlagTag(name, alt) { function melParTag(name, image) { MEL[name, MELPARAGRAPH] = "class=\"special-par " name "-par\">\""" } + +function melFiletypeTag(name, repl) { + MEL[name, MELINSERT] = "" repl "" +} -- cgit v1.3.1-26-gb76a From 3fc1b4e5b19a8d2150e9272ab894b678ce90c7d6 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 25 Feb 2024 14:39:49 +0200 Subject: (awk-edits) Reverted to old MEL parser file name --- awk-edits/MEL--Parser.awk | 99 ----------------------------------------------- awk-edits/MEL-parser.awk | 99 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 99 deletions(-) delete mode 100644 awk-edits/MEL--Parser.awk create mode 100644 awk-edits/MEL-parser.awk (limited to 'awk-edits') diff --git a/awk-edits/MEL--Parser.awk b/awk-edits/MEL--Parser.awk deleted file mode 100644 index 248eff2..0000000 --- a/awk-edits/MEL--Parser.awk +++ /dev/null @@ -1,99 +0,0 @@ -# .*html -# -# == About == -# -# MEL is the "Markdown Extensions Language" -# It's a general metalanguage (I made) for adding custom syntax to Markdown (via awk) -# The idea is it provides parsing for general constructs, and you only need to define -# the names of those constructs and with what they get replaced with -# -# Slightly based on ftags, this system allows you to easily implement the following construts: -# &(name ... &) Multiline "tag", everything inside is formatted by "name" -# &{name ... &} In practice, it just replaces "&[name" and "&]" with the appropriate HTML -# &[name ... &] All three can be used interchangeably, though it's preferrable if -# you use the matching braces and semantically, in your "language" -# square brackets are used for the largest components -# curly for structural components and normal braces for styling -# &:name Format/encapsulate everything until the end of the paragraph -# &::name Format/encapsulate everything until the end of the line -# &.name Insert standalone element as-is -# -# Though it's not decided (or implemented) yet, potentially there will also be: -# &)-( Used to simplify cases of &(name1 ... &) &(name1 ... &) &(name1 ... &) -# &}-{ into &(name1 ... &)-( ... &)-( ... &) -# &]-[ Or maybe for special cases, where rather than doing something like -# &{elementsList &(element1 ... &) &(element2 ... &) &} -# you could simply do -# &{elementsList ... &}-{ ... &}-{ ... &} -# So it will surf as a separator between direct subelements - -BEGIN { - usesMEL() - newStack("mel") -} - -function usesMEL() { - MELOPEN = "o" - MELCLOSE = "c" - MELINSERT = "i" - MELPARAGRAPH = "p" - MELLINE = "l" -} - -// { - melInsideCode = 1 -} - -/<\/code>/ { - melInsideCode = 0 -} - -melInsideCode == 0 && /^[ \t]*(

|

)?&[{[()\]}:.]/ { - newLine = "" - lineCopy = $0 - paragraphed = 0 - while (match(lineCopy, /&(((::|[[{(:.])[^[:space:].:;[{(<>)}\]&]+)|[\]})])/)) { - RSTART += 5 - RLENGTH -= 5 - - # Inside closing tag - if (RLENGTH == 1) { - replaceWith = MEL[topStack("mel"), MELCLOSE] - popStack("mel") - } - # Inside insert - else if (substr(lineCopy, RSTART, 1) == ".") { - name = substr(lineCopy, RSTART + 1, RLENGTH - 1) - - 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 opening tag - else { - name = substr(lineCopy, RSTART + 1, RLENGTH - 1) - - replaceWith = MEL[name, MELOPEN] - pushStack("mel", name) - } - newLine = newLine substr(lineCopy, 0, RSTART - 6) replaceWith - lineCopy = substr(lineCopy, RSTART + RLENGTH) - } - $0 = newLine lineCopy - if (paragraphed == 0 && length(newLine) > 0) - gsub(/(

|<\/p>)/, "") -} diff --git a/awk-edits/MEL-parser.awk b/awk-edits/MEL-parser.awk new file mode 100644 index 0000000..248eff2 --- /dev/null +++ b/awk-edits/MEL-parser.awk @@ -0,0 +1,99 @@ +# .*html +# +# == About == +# +# MEL is the "Markdown Extensions Language" +# It's a general metalanguage (I made) for adding custom syntax to Markdown (via awk) +# The idea is it provides parsing for general constructs, and you only need to define +# the names of those constructs and with what they get replaced with +# +# Slightly based on ftags, this system allows you to easily implement the following construts: +# &(name ... &) Multiline "tag", everything inside is formatted by "name" +# &{name ... &} In practice, it just replaces "&[name" and "&]" with the appropriate HTML +# &[name ... &] All three can be used interchangeably, though it's preferrable if +# you use the matching braces and semantically, in your "language" +# square brackets are used for the largest components +# curly for structural components and normal braces for styling +# &:name Format/encapsulate everything until the end of the paragraph +# &::name Format/encapsulate everything until the end of the line +# &.name Insert standalone element as-is +# +# Though it's not decided (or implemented) yet, potentially there will also be: +# &)-( Used to simplify cases of &(name1 ... &) &(name1 ... &) &(name1 ... &) +# &}-{ into &(name1 ... &)-( ... &)-( ... &) +# &]-[ Or maybe for special cases, where rather than doing something like +# &{elementsList &(element1 ... &) &(element2 ... &) &} +# you could simply do +# &{elementsList ... &}-{ ... &}-{ ... &} +# So it will surf as a separator between direct subelements + +BEGIN { + usesMEL() + newStack("mel") +} + +function usesMEL() { + MELOPEN = "o" + MELCLOSE = "c" + MELINSERT = "i" + MELPARAGRAPH = "p" + MELLINE = "l" +} + +// { + melInsideCode = 1 +} + +/<\/code>/ { + melInsideCode = 0 +} + +melInsideCode == 0 && /^[ \t]*(

|

)?&[{[()\]}:.]/ { + newLine = "" + lineCopy = $0 + paragraphed = 0 + while (match(lineCopy, /&(((::|[[{(:.])[^[:space:].:;[{(<>)}\]&]+)|[\]})])/)) { + RSTART += 5 + RLENGTH -= 5 + + # Inside closing tag + if (RLENGTH == 1) { + replaceWith = MEL[topStack("mel"), MELCLOSE] + popStack("mel") + } + # Inside insert + else if (substr(lineCopy, RSTART, 1) == ".") { + name = substr(lineCopy, RSTART + 1, RLENGTH - 1) + + 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 opening tag + else { + name = substr(lineCopy, RSTART + 1, RLENGTH - 1) + + replaceWith = MEL[name, MELOPEN] + pushStack("mel", name) + } + newLine = newLine substr(lineCopy, 0, RSTART - 6) replaceWith + lineCopy = substr(lineCopy, RSTART + RLENGTH) + } + $0 = newLine lineCopy + if (paragraphed == 0 && length(newLine) > 0) + gsub(/(

|<\/p>)/, "") +} -- cgit v1.3.1-26-gb76a From 7fc2422f038e0f56a9ac489eb4676b7b4bf2b6b1 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 25 Feb 2024 15:37:46 +0200 Subject: (awk-edits/MEL) Properly implemented one line tags --- awk-edits/MEL-parser.awk | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'awk-edits') diff --git a/awk-edits/MEL-parser.awk b/awk-edits/MEL-parser.awk index 248eff2..6cf0514 100644 --- a/awk-edits/MEL-parser.awk +++ b/awk-edits/MEL-parser.awk @@ -35,6 +35,8 @@ BEGIN { function usesMEL() { MELOPEN = "o" MELCLOSE = "c" + MELLINEOPEN = "lo" + MELLINECLOSE = "lc" MELINSERT = "i" MELPARAGRAPH = "p" MELLINE = "l" @@ -52,6 +54,7 @@ melInsideCode == 0 && /^[ \t]*(

|

)?&[{[()\]}:.]/ { newLine = "" lineCopy = $0 paragraphed = 0 + append = "" while (match(lineCopy, /&(((::|[[{(:.])[^[:space:].:;[{(<>)}\]&]+)|[\]})])/)) { RSTART += 5 RLENGTH -= 5 @@ -67,12 +70,12 @@ melInsideCode == 0 && /^[ \t]*(

|

)?&[{[()\]}:.]/ { replaceWith = MEL[name, MELINSERT] } - # Inside one line TODO + # Inside one line else if (substr(lineCopy, RSTART, 2) == "::") { name = substr(lineCopy, RSTART + 2, RLENGTH - 2) - # RLENGTH = length(lineCopy) - replaceWith = MEL[name, MELLINE] + replaceWith = MEL[name, MELLINEOPEN] + append = append MEL[name, MELLINECLOSE] } # Inside paragraph else if (substr(lineCopy, RSTART, 1) == ":") { @@ -93,7 +96,7 @@ melInsideCode == 0 && /^[ \t]*(

|

)?&[{[()\]}:.]/ { newLine = newLine substr(lineCopy, 0, RSTART - 6) replaceWith lineCopy = substr(lineCopy, RSTART + RLENGTH) } - $0 = newLine lineCopy - if (paragraphed == 0 && length(newLine) > 0) + $0 = newLine lineCopy append + if (paragraphed == 0 && newLine != "") gsub(/(

|<\/p>)/, "") } -- 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') 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 6d437b04c4517783e682e2309cc9e0056883c488 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 25 Feb 2024 15:48:19 +0200 Subject: (awk-edits/MEL) Added error messages --- awk-edits/MEL-parser.awk | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'awk-edits') diff --git a/awk-edits/MEL-parser.awk b/awk-edits/MEL-parser.awk index 6cf0514..af1e26d 100644 --- a/awk-edits/MEL-parser.awk +++ b/awk-edits/MEL-parser.awk @@ -42,6 +42,11 @@ function usesMEL() { MELLINE = "l" } +function printErr(message) { + print "ERROR by MEL-parser.awk: " message " | Found in " FILENAME " at line " FNR " & column " RSTART + length(newLine) - 5 ":\n" $0 > "/dev/stderr" + print > "/dev/stderr" +} + // { melInsideCode = 1 } @@ -62,6 +67,10 @@ melInsideCode == 0 && /^[ \t]*(

|

)?&[{[()\]}:.]/ { # Inside closing tag if (RLENGTH == 1) { replaceWith = MEL[topStack("mel"), MELCLOSE] + + if (replaceWith == "") + printErr("Missing closing tag for \"" topStack("mel") "\"") + popStack("mel") } # Inside insert @@ -69,6 +78,9 @@ melInsideCode == 0 && /^[ \t]*(

|

)?&[{[()\]}:.]/ { name = substr(lineCopy, RSTART + 1, RLENGTH - 1) replaceWith = MEL[name, MELINSERT] + + if (replaceWith == "") + printErr("Unknown insertion tag \"" name "\"") } # Inside one line else if (substr(lineCopy, RSTART, 2) == "::") { @@ -76,6 +88,14 @@ melInsideCode == 0 && /^[ \t]*(

|

)?&[{[()\]}:.]/ { replaceWith = MEL[name, MELLINEOPEN] append = append MEL[name, MELLINECLOSE] + + + if (replaceWith == "" && append == "") + printErr("Unknown single line tag \"" name "\"") + else if (replaceWith == "") + printErr("Missing beginning for line tag \"" name "\"") + else + printErr("Missing ending for line tag \"" name "\"") } # Inside paragraph else if (substr(lineCopy, RSTART, 1) == ":") { @@ -85,6 +105,9 @@ melInsideCode == 0 && /^[ \t]*(

|

)?&[{[()\]}:.]/ { RSTART -= 1 RLENGTH += 1 paragraphed = 1 + + if (replaceWith == "") + printErr("Unknown paragraph tag \"" name "\"") } # Inside opening tag else { @@ -92,6 +115,9 @@ melInsideCode == 0 && /^[ \t]*(

|

)?&[{[()\]}:.]/ { replaceWith = MEL[name, MELOPEN] pushStack("mel", name) + + if (replaceWith == "") + printErr("Unknown opening tag \"" name "\"") } newLine = newLine substr(lineCopy, 0, RSTART - 6) replaceWith lineCopy = substr(lineCopy, RSTART + RLENGTH) -- cgit v1.3.1-26-gb76a From 899f51f156dbcaa2457c1ccb7f210b3664bc8dc4 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 25 Feb 2024 15:57:00 +0200 Subject: (awk-edits/MEL) Error messages now underline which part of the line has the error --- awk-edits/MEL-parser.awk | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'awk-edits') diff --git a/awk-edits/MEL-parser.awk b/awk-edits/MEL-parser.awk index af1e26d..90234d4 100644 --- a/awk-edits/MEL-parser.awk +++ b/awk-edits/MEL-parser.awk @@ -42,9 +42,15 @@ function usesMEL() { MELLINE = "l" } -function printErr(message) { - print "ERROR by MEL-parser.awk: " message " | Found in " FILENAME " at line " FNR " & column " RSTART + length(newLine) - 5 ":\n" $0 > "/dev/stderr" - print > "/dev/stderr" +function printErr(message, column, columnPointer) { + column = RSTART + length(newLine) - 5 + print "ERROR by MEL-parser.awk: " message " | Found in " FILENAME " at line " FNR " & column " column ":" > "/dev/stderr" + columnPointer = "" + for (i = -5; i < RLENGTH; i++) + columnPointer = "^" columnPointer + for (i = 1; i < column; i++) + columnPointer = " " columnPointer + print $0 "\n" columnPointer "\n" > "/dev/stderr" } // { -- cgit v1.3.1-26-gb76a From 3ba655be5403c57db776e57f41c07caaa9061b74 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 25 Feb 2024 16:18:46 +0200 Subject: (awk-edits/MEL) Fixed logic for underline --- awk-edits/MEL-parser.awk | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'awk-edits') diff --git a/awk-edits/MEL-parser.awk b/awk-edits/MEL-parser.awk index 90234d4..f0a8f84 100644 --- a/awk-edits/MEL-parser.awk +++ b/awk-edits/MEL-parser.awk @@ -43,13 +43,13 @@ function usesMEL() { } function printErr(message, column, columnPointer) { - column = RSTART + length(newLine) - 5 + column = length($0) - length(lineCopy) + RSTART - 5 print "ERROR by MEL-parser.awk: " message " | Found in " FILENAME " at line " FNR " & column " column ":" > "/dev/stderr" columnPointer = "" - for (i = -5; i < RLENGTH; i++) - columnPointer = "^" columnPointer for (i = 1; i < column; i++) - columnPointer = " " columnPointer + columnPointer = columnPointer " " + for (i = -5; i < RLENGTH; i++) + columnPointer = columnPointer "^" print $0 "\n" columnPointer "\n" > "/dev/stderr" } @@ -95,7 +95,6 @@ melInsideCode == 0 && /^[ \t]*(

|

)?&[{[()\]}:.]/ { replaceWith = MEL[name, MELLINEOPEN] append = append MEL[name, MELLINECLOSE] - if (replaceWith == "" && append == "") printErr("Unknown single line tag \"" name "\"") else if (replaceWith == "") @@ -108,12 +107,13 @@ melInsideCode == 0 && /^[ \t]*(

|

)?&[{[()\]}:.]/ { name = substr(lineCopy, RSTART + 1, RLENGTH - 1) replaceWith = " " MEL[name, MELPARAGRAPH] + + if (replaceWith == " ") + printErr("Unknown paragraph tag \"" name "\"") + RSTART -= 1 RLENGTH += 1 paragraphed = 1 - - if (replaceWith == "") - printErr("Unknown paragraph tag \"" name "\"") } # Inside opening tag else { -- 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') 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') 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') 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') 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