From fe054ac33b1d28ae16dbae9305651188f0b22608 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 20 Jul 2025 19:46:45 +0300 Subject: feat(src/ext): Implemented a large part of the awk_edits functionality via dunbar --- dunbar | 2 +- ext/attention.awk | 9 +++++++++ ext/heading-anchors.awk | 11 +++++++++++ ext/icons.du | 35 +++++++++++++++++++++++++++++++++++ ext/meta.awk | 22 ++++++++++++++++++++++ ext/pagenav.awk | 29 +++++++++++++++++++++++++++++ generate.sh | 2 +- src/meta.tsv | 35 +++++++++++++++++++++++++++++++++++ 8 files changed, 143 insertions(+), 2 deletions(-) create mode 100644 ext/attention.awk create mode 100644 ext/heading-anchors.awk create mode 100644 ext/icons.du create mode 100644 ext/meta.awk create mode 100644 ext/pagenav.awk create mode 100644 src/meta.tsv diff --git a/dunbar b/dunbar index cbd15ad..3a4b534 160000 --- a/dunbar +++ b/dunbar @@ -1 +1 @@ -Subproject commit cbd15add4312e0ef471b1b792387017fc1533e75 +Subproject commit 3a4b5347b12b97a67da220516ec31a4f8c4716c5 diff --git a/ext/attention.awk b/ext/attention.awk new file mode 100644 index 0000000..9182635 --- /dev/null +++ b/ext/attention.awk @@ -0,0 +1,9 @@ +BEGIN { + define("question", open_attention("dialog-question.png")) + define("warn", open_attention("dialog-warning.png")) + define("important", open_attention("dialog-important.png")) +} + +function open_attention(name, image) { + return "

\""" +} diff --git a/ext/heading-anchors.awk b/ext/heading-anchors.awk new file mode 100644 index 0000000..42b85a0 --- /dev/null +++ b/ext/heading-anchors.awk @@ -0,0 +1,11 @@ +BEGIN { + gap = "

" ORS + small_gap = "
" ORS + anchor = ORS "#" + + define("HEADER2", gap "

", "

" anchor) + define("HEADER3", small_gap "

", "

" anchor) + define("HEADER4", small_gap "

", "

" anchor) + define("HEADER5", small_gap "
", "
" anchor) + define("HEADER6", small_gap "
", "
" anchor) +} diff --git a/ext/icons.du b/ext/icons.du new file mode 100644 index 0000000..4878bc7 --- /dev/null +++ b/ext/icons.du @@ -0,0 +1,35 @@ +'define flagdef 'define [$flag] [$alt] + + 'define flag gb + 'define alt ENG + [$flagdef] + + 'define flag bg + 'define alt BGN + [$flagdef] + +'define ftdef 'define [$ft] [$char] + + 'define ft ft-photo + 'define char  + [$ftdef] + + 'define ft ft-text + 'define char  + [$ftdef] + + 'define ft ft-zip + 'define char  + [$ftdef] + + 'define ft ft-movie + 'define char  + [$ftdef] + + 'define ft ft-markdown + 'define char  + [$ftdef] + + 'define ft ft-browser + 'define char  + [$ftdef] diff --git a/ext/meta.awk b/ext/meta.awk new file mode 100644 index 0000000..1815cdf --- /dev/null +++ b/ext/meta.awk @@ -0,0 +1,22 @@ +BEGIN { + FS="\t" + while ((getline < ENVIRON["META"]) > 0) { + if ($1 == "") continue + meta_title[$1] = $2 " — Syndamia" + meta_description[$1] = $3 + } + FS=" " +} + +FNR == 0 { + STD_FILENAME = substr(FILENAME, length(ENVIRON["GEN_DIR"]) + 2) + + if (STD_FILENAME in meta_title) { + substitutions["TITLE"] = meta_title[STD_FILENAME] + substitutions["DESCRIPTION"] = meta_description[STD_FILENAME] + } + else { + delete substitutions["TITLE"] + delete substitutions["DESCRIPTION"] + } +} diff --git a/ext/pagenav.awk b/ext/pagenav.awk new file mode 100644 index 0000000..0cd08fc --- /dev/null +++ b/ext/pagenav.awk @@ -0,0 +1,29 @@ +FNR == 0 { + # Stats element + stats = \ +"
" ORS \ +" Reading: [$expected-reading] || Created: [$created] || Edited: [$edited]" ORS \ +" || GitLab source" ORS \ +"
" + + # Breadcrumbs element + match(FILEDIR, /(blog|slides|teaching|tutorials|misc)/) + foldersLen = split(substr(FILEDIR, RSTART), folders, "/") + + href = ".." + breadcrumb = " » " folders[foldersLen] "" + for (i = foldersLen-1; i > 0; i--) { + breadcrumb = " » " "" folders[i] "" breadcrumb + href = "../" href + } + breadcrumb = \ +"
" ORS \ +" " breadcrumb ORS \ +"
" + + substitutions["pagenav"] = \ +".text
" ORS \ + stats ORS \ + breadcrumb ORS \ +"
" +} diff --git a/generate.sh b/generate.sh index cb3f7c6..3d62dcb 100755 --- a/generate.sh +++ b/generate.sh @@ -30,7 +30,7 @@ EOF rm "$GEN_DIR/$META_FILE" "$GEN_DIR/."* META="$SRC_DIR/$META_FILE" - export META + export META GEN_DIR /usr/bin/env dash ./dunbar/dunbar_awk/dunbar.sh html \ -o . \ diff --git a/src/meta.tsv b/src/meta.tsv new file mode 100644 index 0000000..3ea995e --- /dev/null +++ b/src/meta.tsv @@ -0,0 +1,35 @@ +404.du 404 page not found! +accessibility.du Accessibility I do want to make sure the content on this website is consumable by people with disabilities, however I also want to fancy features. I'm currently maintaining a balance between the two. +acknowledgements.du Acknowledgements A list of (mostly) icon projects and blog inspirations +index.du Home My personal website +license.du License CC BY-SA for articles, pictures, ... and GNU GPLv3 for source code +misc.du Miscellaneous Other types of content I've made, including documents, images, videos and web demos. +privacy.du Privacy policy syndamia.com (and tiny.syndamia.com) offer no use data submission and implement no JavaScript-based tracking. Standard HTTP logs are collected. +regarding-js.du Regarding usage of JavaScript Listing of the different JavaScript scripts used in this website and the data they store in the browser. +rework.du Due for rework Page is due for a rework! + +about.du About Me Contacts, resume, (Anti)bio, and software projects +about/index.du About Me Contacts, resume, (Anti)bio, and software projects +setup.du Setup Hardware and software setups I have or have had. +setup/index.du Setup Hardware and software setups I have or have had. + +blog.du Blog Articles detailing personal experiences or exploration of certain topics +blog/index.du Blog Articles detailing personal experiences or exploration of certain topics + +teaching.du Teaching List of subjects and their corresponding materials I've taught +teaching/index.du Teaching List of subjects and their corresponding materials I've taught + +tutorials.du Tutorials Educational articles +tutorials/index.du Tutorials Educational articles + +slides.du Slides Slides from presentations I've made +slides/index.du Slides Slides from presentations I've made + +preserved-media.du Preserved media An assortment of documents, videos, etc. which are not made by me, but aren't archived on the internet or have the potential of permanently disappearing. +preserved-media/index.du Preserved media An assortment of documents, videos, etc. which are not made by me, but aren't archived on the internet or have the potential of permanently disappearing. + +preserved-web-pages.du Preserved Web pages Web pages/sites with endangered archival, not made by me, that I've decided to host. +preserved-web-pages/index.du Preserved Web pages Web pages/sites with endangered archival, not made by me, that I've decided to host. + +misc/index.du Miscellaneous Other types of content I've made, including documents, images, videos and web demos. +misc/universitetski-belejki/index.du Университетски бележки Разнообразни материали, които съм правел през следването ми във ФМИ. -- cgit v1.3.1-26-gb76a