diff options
| Commit | 0fbac293a5b3ab2e1360d8dc2743c1ae71bc128f (patch) | |
|---|---|---|
| Author | 2025-08-18 19:02:23 +0300 | |
| Committer | 2025-08-18 19:02:23 +0300 | |
| Files | 13c6679e365a6f5fb8928b82b176017d85dee1db | |
| syndamia.com-0fbac293a5b3ab2e1360d8dc2743c1ae71bc128f.tar syndamia.com-0fbac293a5b3ab2e1360d8dc2743c1ae71bc128f.tar.gz syndamia.com-0fbac293a5b3ab2e1360d8dc2743c1ae71bc128f.zip | ||
| Parent | 6f20ac5169469d42f5c945e3de01b297dc028c02 (diff) | |
chore: Remove outdated files
14 files changed, 0 insertions, 910 deletions
| -rw-r--r-- | awk-edits/#stack.awk | 26 | ||||
| -rw-r--r-- | awk-edits/#strings.awk | 130 | ||||
| -rw-r--r-- | awk-edits/Group-contents.awk | 24 | ||||
| -rw-r--r-- | awk-edits/Heading-anchors.awk | 16 | ||||
| -rw-r--r-- | awk-edits/MEL-Iconified.awk | 42 | ||||
| -rw-r--r-- | awk-edits/MEL-Presentation.awk | 94 | ||||
| -rw-r--r-- | awk-edits/MEL-Teaching.awk | 8 | ||||
| -rw-r--r-- | awk-edits/MEL-parser.awk | 134 | ||||
| -rw-r--r-- | awk-edits/Pagenav.awk | 50 | ||||
| -rw-r--r-- | awk-edits/README.md | 37 | ||||
| -rw-r--r-- | awk-edits/Svg-height-attrib.awk | 17 | ||||
| -rw-r--r-- | awk-edits/Syntax-highlighting.awk | 280 | ||||
| -rwxr-xr-x | install-ssg-lowdown.sh | 25 | ||||
| -rwxr-xr-x | md-to-du.sed | 27 |
diff --git a/awk-edits/#stack.awk b/awk-edits/#stack.awk deleted file mode 100644 index a8b0b2a..0000000 --- a/awk-edits/#stack.awk +++ /dev/null @@ -1,26 +0,0 @@ -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/#strings.awk b/awk-edits/#strings.awk deleted file mode 100644 index 1441e41..0000000 --- a/awk-edits/#strings.awk +++ /dev/null @@ -1,130 +0,0 @@ -# gosub(regexp, replacement [, target]) -# Aka global original sub -# Behaves like gsub, however doesn't try regexp on previoud replacements -# and returns the result string, rather than doing it inplace. -function gosub(regexp, replacement, target) { - if (!length(target)) { - target = $0; - } - - result = ""; - matched = ""; - while (match(target, regexp)) { - result = result substr(target, 1, RSTART - 1); - matched = substr(target, RSTART, RLENGTH); - target = substr(target, RSTART + RLENGTH); - - sub(regexp, replacement, matched); - result = result matched; - } - - return result target; -} - -# gesub(regexp, exregexp, replacement [, target]) -# Aka global excluding sub -# Behaves like gsub, however substitutes only where exregexp doesn't match -# and returns the result string, rather than doing it inplace. -function gesub(regexp, exregexp, replacement, target) { - if (!length(target)) { - target = $0; - } - - result = ""; - while (match(target, exregexp)) { - beg = substr(target, 1, RSTART - 1); - exclude = substr(target, RSTART, RLENGTH); - target = substr(target, RSTART + RLENGTH); - gsub(regexp, replacement, beg); - result = result beg exclude; - } - - gsub(regexp, replacement, target); - - return result target; -} - -# glsub(lbregexp, regexp, largexp, replacement [, target]) -# Aka global sub with non-capturing look-around (lookbehind and lookahead) -# Behaves kind of like gsub, however substitution of regexp with replacement -# only happens, when regexp is preceded by lbregexp and succeeded by laregexp. -# Only regexp get's replaced, the matches of lbregexp and laregexp are left -# as-is. Overlapping of the lookahead and lookbehind substrings is supported, -# but any sort of overlapping which includes regexp isn't. -# This function is quite slow, try to use as little as possible. -# Returns the result string, rather than doing it inplace. -function glsub(lbregexp, regexp, laregexp, replacement, target) { - if (!length(target)) { - target = $0; - } - - result = "" - while (match(target, lbregexp regexp)) { - result = result substr(target, 1, RSTART - 1); - matched = substr(target, RSTART, RLENGTH); - target = substr(target, RSTART + RLENGTH); - - match(target, laregexp); - if (RSTART == 1) { - match(matched, regexp); - result = result substr(matched, 1, RSTART - 1); - matched = substr(matched, RSTART); - sub(/.*/, replacement, matched); - } - result = result matched; - } - - return result target; -} - -# gbsub(lbrace, rbrace, replacement [, target ]) -# Aka global brace sub -# Properly substitutes recursive braced expressions, i.e. -# for "((1+2) * (3/(4-9)))", substitution is done first -# on "(1+2)", then on "(4-9)", afterwards on "(3/SOMETHING)" -# (where "(4-9)" turns into "SOMETHING" after substitution), -# and finally, the whole equation (with it's inner stuff -# substituted) is substituted. -# This is useful when one of the braces can exist as-is, but -# can also be paired with a special (opening/closing) brace. -# For example, in bash parameter expansion is specified with -# "${...}", however "}" can also be the closing brace of a function. -function gbsub(lbrace, rbrace, replacement, target) { - if (!length(target)) { - target = $0; - } - - result = substr(target, 1, match(target, lbrace) - 1); - depth = 1; - LLN = 0; - while (!(LLN == -1 && depth == 1)) { - match(target, lbrace); LST = RSTART; LLN = RLENGTH; - match(target, rbrace); - - # rbrace, pop stack - if (depth > 1 && (LST == 0 || LST > RSTART)) { - depth--; - level[depth] = level[depth] substr(target, 1, RSTART + RLENGTH - 1); - sub(/.*/, replacement, level[depth]); - if (depth > 1) { - level[depth - 1] = level[depth - 1] level[depth]; - } - else { - result = result level[1]; - level[1] = ""; - } - target = substr(target, RSTART + RLENGTH); - } - # lbrace, push stack - else if (LST > 0 && LST < RSTART) { - if (depth > 1) prev = depth - 1; - else prev = depth; - - level[prev] = level[prev] substr(target, 1, LST - 1); - level[depth++] = substr(target, LST, LLN); - target = substr(target, LST + LLN); - } - } - - return result target; -} diff --git a/awk-edits/Group-contents.awk b/awk-edits/Group-contents.awk deleted file mode 100644 index 43fa460..0000000 --- a/awk-edits/Group-contents.awk +++ /dev/null @@ -1,24 +0,0 @@ -# .*(blog|slides|teaching|tutorials|misc)/.*/.*html -# -# == About == -# -# Some pages contain contents info, comprised of a "Contents" heading (h2) and a -# (usually ordered) list of anchors to headings in the current page. -# This script groups that heading and list into a wrapper element with id -# "contents-container", which can then be handled more specifically. -# -# In my case, the contents appear on the right of remaining text. - -BEGIN { - started = 0 -} - -/h2 id="contents"/ { - print "<div id=\"contents-container\">" - started = 1 -} - -started == 1 && /<p>/ { - print "</div>" - started = 0 -} diff --git a/awk-edits/Heading-anchors.awk b/awk-edits/Heading-anchors.awk deleted file mode 100644 index 7d4edf8..0000000 --- a/awk-edits/Heading-anchors.awk +++ /dev/null @@ -1,16 +0,0 @@ -# .*html -# -# == About == -# -# ssg generates an id for every heading. That's why after every heading there -# can be a hyperlink to itself. However, because of the current styling, such a -# hyperlink is required (except for h1). - -/[ \t]*<h[23456]/ { - if (match($0, /<h2 id="contents"/) == 0) { - match($0, /<h./) - gap = "<div class=\"gap" ((substr($0, RSTART + 2, 1) == 2) ? "" : "-small") "\"></div>" ORS - } - match($0, /id="[^"]*"/) - $0 = gap $0 ORS "<a class=\"h-anchor\" href=\"#" substr($0, RSTART + 4, RLENGTH - 5) "\" aria-hidden=\"true\">#</a>" -} diff --git a/awk-edits/MEL-Iconified.awk b/awk-edits/MEL-Iconified.awk deleted file mode 100644 index 332be46..0000000 --- a/awk-edits/MEL-Iconified.awk +++ /dev/null @@ -1,42 +0,0 @@ -# .*html - -BEGIN { - usesMEL() - # - # Flags - # - - melFlagTag("gb", "ENG") - melFlagTag("bg", "BGN") - - # - # Noteworthy paragraphs - # - - 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) { - MEL[name, MELINSERT] = "<img src=\"/img/" name ".svg\" class=\"flag unzoomable svg\" alt=\"" name "\" height=18>" -} - -function melParTag(name, image) { - MEL[name, MELPARAGRAPH] = "class=\"special-par " name "-par\"><img src=\"/img/" image "\" class=\"special-par-icon borderless unzoomable\" alt=\"" name "\">" -} - -function melFiletypeTag(name, repl) { - MEL[name, MELINSERT] = "<span class=\"file-type-icon\">" repl "</span>" -} diff --git a/awk-edits/MEL-Presentation.awk b/awk-edits/MEL-Presentation.awk deleted file mode 100644 index cabc928..0000000 --- a/awk-edits/MEL-Presentation.awk +++ /dev/null @@ -1,94 +0,0 @@ -# .*(slides|teaching)/.*html - -BEGIN { - usesMEL() - # - # 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) { - fontClass = (ind != 0) ? " font" fontSizes[ind] : "" - - MEL["slide" fontSizes[ind], MELOPEN] = "<div id=\"[SLIDEID]\" class=\"slide" fontClass "\">" - MEL["slide" fontSizes[ind], MELCLOSE] = "</div>" - MEL["middle" fontSizes[ind], MELOPEN] = "<div id=\"[SLIDEID]\" class=\"slide centered-slide" fontClass "\"><div></div><div>" - MEL["middle" fontSizes[ind], MELCLOSE] = "</div><div></div></div>" - MEL["title" fontSizes[ind], MELOPEN] = "<div id=\"[SLIDEID]\" class=\"slide centered-slide centered" fontClass "\"><div></div><div>" - MEL["title" fontSizes[ind], MELCLOSE] = "</div><div></div></div>" - - standardPresentationTag("centered" fontSizes[ind], "centered" fontClass) - } - - # 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", MELINSERT] = ORS \ -"<nav id=\"presentCont\">" ORS \ -" <span id=\"prevSlideBtn\" class=\"btn nodisplay\">←</span>" ORS \ -" <a id=\"slideIndex\" class=\"nodisplay\" href=\"#slide-0\">0</a>" ORS \ -" <span id=\"nextSlideBtn\" class=\"btn nodisplay\">→</span>" ORS \ -" <span id=\"articleBtn\" class=\"btn setting-btn\">Article view ☲</span>" ORS \ -" <span id=\"presentBtn\" class=\"btn setting-btn\">Present ⎚</span>" ORS \ -" <span id=\"printBtn\" class=\"btn setting-btn\">Print ⎙</span>" ORS \ -" </nav><br><br>" ORS \ -" <script type=\"text/javascript\" src=\"/scripts/presentation.js\" crossorigin=\"anonymous\"></script>" - - MEL["row", MELOPEN] = "<div class=\"layout-table\"><div class=\"layout-row\">" # <table><tr> (layout-row > * is td) - MEL["row", MELCLOSE] = "</div></div>" # </tr><table> - - MEL["sqrow", MELOPEN] = "<div class=\"layout-table fixed-layout\"><div class=\"layout-row\">" # <table><tr> (layout-row > * is td) - MEL["sqrow", MELCLOSE] = "</div></div>" - - MEL["newrow", MELINSERT] = "</div><div class=\"layout-row\">" # </tr><tr> - - # - # Generated tags - # - - for (i = 1; i <= 9; i++) { - MEL["br" i, MELINSERT] = "<div class=\"br" i "\"></div>" - } - for (i = 5; i <= 95; i++) { - standardPresentationTag("width" i "%", "width" i "per") - } - - # - # Ordinary - # - - standardPresentationTag("fright", "float-right") - standardPresentationTag("column") -} - -function standardPresentationTag(name, class) { - if (class == "") class = name - MEL[name, MELOPEN] = "<div class=\"" class "\">" - MEL[name, MELCLOSE] = "</div>" -} - -/\[SLIDEID\]/ { - sub(/\[SLIDEID\]/, "slide-" slideIndex++) -} diff --git a/awk-edits/MEL-Teaching.awk b/awk-edits/MEL-Teaching.awk deleted file mode 100644 index 245d6fa..0000000 --- a/awk-edits/MEL-Teaching.awk +++ /dev/null @@ -1,8 +0,0 @@ -# .*teaching/.*html - -BEGIN { - usesMEL() - - MEL["solution-link", MELLINEOPEN] = "<div class=\"exercise-solution\"><" - MEL["solution-link", MELLINECLOSE] = " ></div>" -} diff --git a/awk-edits/MEL-parser.awk b/awk-edits/MEL-parser.awk deleted file mode 100644 index 777caa1..0000000 --- a/awk-edits/MEL-parser.awk +++ /dev/null @@ -1,134 +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" - MELLINEOPEN = "lo" - MELLINECLOSE = "lc" - MELINSERT = "i" - MELPARAGRAPH = "p" - MELLINE = "l" -} - -function printErr(message, column, columnPointer) { - 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 = 1; i < column; i++) - columnPointer = columnPointer " " - for (i = -5; i < RLENGTH; i++) - columnPointer = columnPointer "^" - print $0 "\n" columnPointer "\n" > "/dev/stderr" -} - -/<code>/ { - melInsideCode = 1 -} - -/<\/code>/ { - melInsideCode = 0 -} - -melInsideCode == 0 && /^[ \t]*(<p>|<dt>)?&[{[()\]}:.]/ { - newLine = "" - lineCopy = $0 - paragraphed = 0 - append = "" - while (match(lineCopy, /&(((::|[[{(:.])[^[:space:].:;[{(<>)}\]&]+)|[\]})])/)) { - RSTART += 5 - RLENGTH -= 5 - - # Inside closing tag - if (RLENGTH == 1) { - replaceWith = MEL[topStack("mel"), MELCLOSE] - - if (replaceWith == "") - printErr("Missing closing tag for \"" topStack("mel") "\"") - - popStack("mel") - } - # Inside insert - else if (substr(lineCopy, RSTART, 1) == ".") { - 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) == "::") { - name = substr(lineCopy, RSTART + 2, RLENGTH - 2) - - replaceWith = MEL[name, MELLINEOPEN] - append = append MEL[name, MELLINECLOSE] - - if (replaceWith == "") - printErr("Missing beginning for line tag \"" name "\"") - else if (MEL[name, MELLINECLOSE] == "") - printErr("Missing ending for line tag \"" name "\"") - else if (replaceWith == "" && MEL[name, MELLINECLOSE] == "") - printErr("Unknown single line tag \"" name "\"") - } - # Inside paragraph - else if (substr(lineCopy, RSTART, 1) == ":") { - name = substr(lineCopy, RSTART + 1, RLENGTH - 1) - - replaceWith = " " MEL[name, MELPARAGRAPH] - - if (replaceWith == " ") - printErr("Unknown paragraph tag \"" name "\"") - - RSTART -= 1 - RLENGTH += 1 - paragraphed = 1 - } - # Inside opening tag - else { - name = substr(lineCopy, RSTART + 1, RLENGTH - 1) - - 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) - } - $0 = newLine lineCopy append - if (paragraphed == 0 && newLine != "") - gsub(/(<p>|<\/p>)/, "") -} diff --git a/awk-edits/Pagenav.awk b/awk-edits/Pagenav.awk deleted file mode 100644 index 3b05c10..0000000 --- a/awk-edits/Pagenav.awk +++ /dev/null @@ -1,50 +0,0 @@ -# .*(blog|slides|teaching|tutorials|misc)/.*/.*html -# -# == About == -# -# I call pagenav the stuff directly below the first h1. These include file dates -# and GitLab source link. -# Currently it only works for blog and tutorial pages. -# -# This is by far the most hard-coded and inefficient awk script in awk-edits. -# Creation and last edited dates are taken from git commits, and getting the correct info -# by file name can only be done (easily) with git log, which is unfortunately very slow. -# Another issue is that it depends on the build directories in build scripts, meaning -# it won't work without modification if you try to build it somewhere else. -# -# Split into Pagenav.awk and post-pagenav.awk - -nopagenav == 0 && /<h1/ { - match(FILENAME, /(blog|slides|teaching|tutorials|misc)\/.*\//) - path = substr(FILENAME, RSTART, length(FILENAME) - RSTART - 3) - - # Stats element - stats = "<div id=\"pagenav-stats\">" ORS \ -" <strong>Reading: " (int(words / 180) + 1) " min</strong> || <strong>Created: " created "</strong> || <strong>Edited: " edited "</strong>" ORS \ -" || <a href=\"https://gitlab.com/Syndamia/syndamiadotcom/-/blob/master/src/" path "md\"><strong>GitLab source</strong></a>" ORS \ -"</div>" - - # Breadcrumbs element - sub(/\/[^/]*$/, "", path) - foldersLen = split(path, folders, "/") - - href = ".." - breadcrumb = " » <em>" folders[foldersLen] "</em>" - for (i = foldersLen-1; i > 0; i--) { - breadcrumb = " » " "<a href=" href ">" folders[i] "</a>" breadcrumb - href = "../" href - } - breadcrumb = \ -" <div id=\"pagenav-breadcrumb\">" ORS \ -" " breadcrumb ORS \ -" </div>" - - # Pagenav element - $0 = $0 ORS \ -"<div id=\"pagenav\">" ORS \ - stats ORS \ - breadcrumb ORS \ -"</div>" - - nopagenav = 1 -} diff --git a/awk-edits/README.md b/awk-edits/README.md deleted file mode 100644 index fd1b713..0000000 --- a/awk-edits/README.md +++ /dev/null @@ -1,37 +0,0 @@ -These AWK scripts are part of the 3rd "stage" in `generate.sh`, they edit the generated (by ssg and lowdown) HTML pages. -This allows for custom Markdown syntax and special formatting, for more info, read about [SS-Law](https://syndamia.gitlab.io/ss-law). - -Without the `devs` argument, `generate.sh` concatenates all of them into one big file, where the order is dependant on the first character of the filename: at the top are those starting with "#", then those with capital letter and finally those with a lowercase letter (however there is no order between files with the same type of starting character). - -For this reason: - -- Files, starting with "#" are "libraries", just AWK scripts that contain only functions -- Files, starting with a capital letter, are (their code) executed before the line printing (more on that in a bit) -- Files, starting with a lower case letter, are (their code) executed after the line printing - -This is why the following constraints have to be considered: - -- If every script printed `$0`, then every line would be duplicated multiple times. - That is why you **mustn't** print the current line in your own script, `generate.sh` passes the appropriate AWK code. - If you don't want the line to be printed, do `$0 = 0`. -- Variable names between scripts must be unique, because when combined, unexpected behaviour might occur. -- `exit` **mustn't** be used! - Instead, use a variable and then add a check in the "pattern" part for every rule where you would want to exit. - -## ftags - -ftags are strings/words in the Markdown source files, that start with "&&" and continue with any (valid) sequence of characters. -AWK scripts replace ftags with corresponding HTML. - -List of scripts that handle ftags: - -|Script|ftags| -|---|---| -|`File-lists.awk`|`&&folder`, `&&file`, `&&/files`, `&&fd`, `&&ft-TYPE` *(TYPE is one of `photo`, `text`, `zip`, `movie`, `markdown`)*| -|`Flags.awk`|`&&gb`, `&&bg`| -|`Presentation.awk`|`&&presentation`, `&&slide`, `&&/slide`, `&&clide`, `&&/clide`, `&&table`, `&&ftable`, `&&tarow`, `&&/table`, `&&linebN` *(N is one of 1, 2, ..., 9)*, `&&fontSIZE` *(SIZE is one of `18`, `20`, `22`, `25`, `27`, `35`)*, `&&/font`, `&¢ered`, `&&/centered`, `&&fright`, `&&/fright`, `&&cont`, `&&/cont`| - -Information regarding their usage can be found at the top of their respective script file. - -The name initially stood for "file tags", since I got the idea while making the file lists functionality. -Now I like to think of them as "format tags", since they are used for so much more. diff --git a/awk-edits/Svg-height-attrib.awk b/awk-edits/Svg-height-attrib.awk deleted file mode 100644 index 9e49769..0000000 --- a/awk-edits/Svg-height-attrib.awk +++ /dev/null @@ -1,17 +0,0 @@ -# .*html -# -# == About -# -# This script forces all images with SVG source, which aren't alone, to have -# a hard-coded height to them. The idea is to not make SVGs inside text take -# up the whole screen. -# This is mostly done for browsers that do not support CSS. - -/<p>.+<img src="[^"]*\.svg"/ || /src="[^"]*\.svg"[^>]*>.+<\/p>/ { - result = "" - while(match($0, /src="[^"]*\.svg"/)) { - result = result substr($0, 1, RSTART + RLENGTH - 1) " height=18"; - $0 = substr($0, RSTART + RLENGTH); - } - $0 = result $0; -} diff --git a/awk-edits/Syntax-highlighting.awk b/awk-edits/Syntax-highlighting.awk deleted file mode 100644 index 577ecb3..0000000 --- a/awk-edits/Syntax-highlighting.awk +++ /dev/null @@ -1,280 +0,0 @@ -# .*(blog|slides|teaching|tutorials|misc)/.*/.*html -# -# == About == -# -# This script wraps certain code block patterns in spans, enabling code syntax highlighting. -# The styling classes are defined in the bottom of styles.css -# You'll need to specify the language in markdown, like this -# -# ```cpp -# code here -# ``` -# -# where cpp should be your language of choice. - -BEGIN { - # This variable specifies what language is currently being highlighted. - # 0 is none, and >0 is the index/id of the language. - syntaxhighlighting=0; -} - -function hi(pat, class) { - gsub(pat, "<span class=\"HI-" class "\">&</span>"); -} -function hie(pat, epat, class) { - return gesub(pat, epat, "<span class=\"HI-" class "\">&</span>"); -} -function hil(lbpat, pat, lrpat, class) { - return glsub(lbpat, pat, lrpat, "<span class=\"HI-" class "\">&</span>"); -} -function hib(lbrace, rbrace, class) { - return gbsub(lbrace, rbrace, "<span class=\"HI-" class "\">&</span>"); -} - -# -# -- Global -- -# - -syntaxhighlighting > 0 || /class="language-/ { - $0 = gesub(@/=/, "<[^>]*>", "\\="); -} - -# -# -- Grammars -- -# -# Code in the form -# name -> expression | expression | ... -# -# Supports "grammar" and "grammar+", the difference being that the first resets -# what grammer names have been found in predvious grammar code blocks, -# while the second doesn't. -# The idea is that you could want to define a grammar in one code block, -# do some explanations and then continue the definition with other rules. -# - -syntaxhighlighting == 0 && /class="language-grammar"/ { - grammarNamesI = 0; - syntaxhighlighting = 1; -} - -syntaxhighlighting == 0 && /class="language-grammar\+"/ { - syntaxhighlighting = 1; -} - -syntaxhighlighting == 1 { - # Extract the name of the current grammar in the array grammarNames - # Since a grammar name could appear in multiple different rule expressions - grammarDef = match($0, /[[:alnum:]]+[[:blank:]]*->/); - grammarNames[++grammarNamesI] = substr($0, grammarDef, match($0, /[[:blank:]]+->[[:blank:]]+/) - grammarDef); - # If we couldn't find a name in the current line, or the rule name already exists, - # make sure not to "add" it. grammarNamesI acts as an array size, so decrementing it - # effectively "removes" the current string. - if (grammarDef == 0 || grammarNames[grammarNamesI] == "") grammarNamesI--; - else { - for (i = 1; i < grammarNamesI; i++) { - if (grammarNames[i] == grammarNames[grammarNamesI]) { - grammarNamesI--; - break; - } - } - } - - for (i = 1; i <= grammarNamesI; i++) { - $0 = hie(grammarNames[i], @/<span [^>]*>[^<]*<\/[^>]*>/, "function"); - } - hi(@/->/, "statement"); - hi(@/\|/, "statement"); -} - -# -# -- Regexes -- -# -# Supports "regex" - -syntaxhighlighting == 0 && /class="language-regex"/ { - syntaxhighlighting = 2; -} - -syntaxhighlighting == 2 { - syntaxhighlighting = 2; - - hi(@/\*/, "repeat"); - hi(@/[\(\)\|]/, "statement"); -} - -# -# -- Bash -# -# Supports "bash" - -/class="language-bash"/ { - syntaxhighlighting = 3; - # The first code block line could look something like - # <pre><code class="language-bash">class="langage-bash" - # So, if we want to do something with the word class or strings, - # we'll need to skip the tags from the beginning. - tagend = match($0, /class="language-bash"/) + 21; - prestart = substr($0, 0, tagend); - $0 = substr($0, tagend + 1); -} - -syntaxhighlighting == 3 { - $0 = hie(@/"[^"]*"/, "<[^>]*>", "string"); - $0 = hil(@/(^|[^>&])/, - @/#.*$/, - "", - "comment"); - $0 = hib("\\$\\{", "\\}", "structure"); - $0 = hib("\\$\\(\\(", "\\)\\)", "structure"); - $0 = hib("\\$\\(", "\\)", "structure"); - hi(@/\$[[:alnum:]]+/, "structure"); - $0 = hil(@/[^[:alnum:]#\$]/, - @/[[:digit:]]+/, - @/([^[:alnum:]]|$)/, - "number"); - $0 = hil(@/[[:blank:]]+/, @/-[-_[:alnum:]]+/, "", "operator"); - $0 = hil(@/(^|[^[:alnum:]])/, - @/(if|fi|then|case|esac|==|!=|-eq|-ne|-gt|-ge|-lt|-le|;;|;|\|\||&&)/, - @/([^[:alnum:]]|$)/, - "conditional"); - $0 = hil(@/(^|[^[:alnum:]])/, - @/(for|while|until|in|do|done)/, - @/([^[:alnum:]]|$)/, - "repeat"); - $0 = hil(@/(^|[[:blank:]]+)/, - @/[[:alnum:]]+/, - @/(|\+|-)=/, - "identifier"); - $0 = hil("", - @/[-_[:alnum:]]+[[:blank:]]*/, - @/\([^\)]*\)/, - "function"); - hi(@/^[[:blank:]]*[-_[:alnum:]]+/, "statement"); -} - - -# -# -- C-like programming languages -- -# - -# -# -- C++ -- -# -# Supports "cpp" - -/class="language-cpp"/ { - syntaxhighlighting = 101; -} - -syntaxhighlighting == 101 { - $0 = hil(@/(^|[^[:alnum:]])/, - @/(string)/, - @/([^[:alnum:]]|$)/, - "type"); -} - -# -# -- C# -- -# -# Supports "csharp" - -/class="language-csharp"/ { - syntaxhighlighting = 102; -} - -syntaxhighlighting == 102 { - $0 = hil(@/(^|[^[:alnum:]])/, - @/(new|public|protected|private|override)/, - @/([^[:alnum:]]|$)/, - "keyword"); - hi(@/<[-_[:alpha:]]+>/, "typedef"); - $0 = hie(@/[_[:upper:]][_[:upper:]][_[:upper:]][_[:upper:]]+/, @/<[^>]*>/, "const"); -} - -# -# -- lex -- -# -# Supports "lex" - -/class="language-lex"/ { - syntaxhighlighting = 103; -} - -syntaxhighlighting == 103 { - hi(@/%[^[:blank:]]+/, "storageclass"); -} - -# -# -- yacc -- -# -# Supports "yacc" - -/class="language-yacc"/ { - syntaxhighlighting = 104; -} - -syntaxhighlighting == 104 { - hi(@/%[^[:blank:]]+/, "storageclass"); -} - -# -# -- C -- -# -# Supports "c" and is used in C-like programming languages - -/class="language-c"/ { - syntaxhighlighting = 100; -} - -syntaxhighlighting >= 100 { - $0 = hie(@/"[^"]*"/, "<[^>]*>", "string"); - hi(@/(//.*$|/\*.*$|^[^\*]*\*/)/, "comment"); - $0 = hil(@/[^[:alnum:]#\$]/, - @/[[:digit:]]+/, - @/[^[:alnum:]]/, - "number"); - $0 = hil(@/[^[:alnum:]#\$]/, - @/[[:digit:]]+\.[[:digit:]]+/, - @/[^[:alnum:]]/, - "float"); - $0 = hil("", - @/[-_[:alnum:]]+/, - @/[[:blank:]]*(|\+|-|\*|/|%|<<|>>|&|\^|\|)=/, - "identifier"); - $0 = hil("", - @/[-_[:alnum:]]+[[:blank:]]*/, - @/\(/, - "function"); - hi(@/(==|!=|<=|>=|&&|\|\||!)/, "conditional"); - $0 = hil(@/(^|[^-[:alnum:]])/, - @/(break|continue|do|for|goto|while)/, - @/([^[:alnum:]]|$)/, - "repeat"); - $0 = hil(@/(^|[^-[:alnum:]])/, - @/(case|const|default|else|extern|if|return|sizeof|switch|typedef)/, - @/([^[:alnum:]]|$)/, - "keyword"); - $0 = hil(@/(^|<.*>)[[:blank:]]*/, - @/#[[:alpha:]]+/, - "", - "preproc"); - $0 = hil(@/(^|[^-[:alnum:]])/, - @/(auto|char|double|float|int|long|short|signed|unsigned|bool|void)/, - @/([^[:alnum:]]|$)/, - "type"); - hi(@/'[\\]?[ -~]'/, "char"); - hi(@/(true|false)/, "bool"); - $0 = hil(@/(^|[^[:alnum:]])/, - @/(enum|struct|union)/, - @/([^[:alnum:]]|$)/, - "storageclass"); -} - -tagend != 0 { - $0 = prestart $0; - tagend = 0; -} - -syntaxhighlighting > 0 && /<\/code>/ { - syntaxhighlighting = 0; -} diff --git a/install-ssg-lowdown.sh b/install-ssg-lowdown.sh deleted file mode 100755 index 9d5579a..0000000 --- a/install-ssg-lowdown.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -cd /tmp - -sudo apt install -y curl git make gcc - -echo "Installing ssg (latest version)" - -curl -s https://rgz.ee/bin/ssg > ssg -chmod +x ssg -sudo mv ssg /usr/bin/ - -echo "Installing lowdown" - -if [ -d "lowdown" ]; then - sudo rm -rf lowdown -fi -git clone https://github.com/kristapsdz/lowdown -cd lowdown/ -sudo ./configure -sudo make -sudo make install - -echo "Done" - diff --git a/md-to-du.sed b/md-to-du.sed deleted file mode 100755 index 7aeeaf3..0000000 --- a/md-to-du.sed +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env -S sed -rf - -#== Inline elements ==# - -# <br> -> \n -s/<br>/\\n/g -s/ $/\\n/ - -# `...` -> `[...]` -s/`([^`]+)`/`[\1]`/g -# **...** -> =[...]= -s/\*\*([^*]+)\*\*/=[\1]=/g -# *...* -> *[...]* -s/\*([^*]+)\*/*[\1]*/g - -# [TITLE](URL) -> [url URL TITLE] -s/\[([^]]*)\]\(([^)]*)\)/[url \2 \1]/g - -s/!\[url/[image/g - -#== syndamia.com specifics ==# - -s/^---$/[$line]/g - -#-- MEL --# -# &.x -> [$x] -s/&\.([^ \t]+)/[$\1]/g |