Summary Files Commits Branches @commit @diff @stats
path: root / md-meta.awk
diff options
context:
space:
mode:
Commit7ddce59190f8cb35a4f5108114d8575dd868940e (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-03-03 16:01:06 +0200
Committer
 Syndamia <kamen@syndamia.com>
2025-03-03 16:01:06 +0200
Files60df6ba5e8112370ea9cb7b469f38a5b7be1dc45 /md-meta.awk
csg-singleton.tar
csg-singleton.tar.gz
csg-singleton.zip
Parent26d11dc3d7c2f3df7ec0bd678448c6cde4544496 (diff)
feat: Preliminary implementation of footnotes singleton
Markdown isn't parsed in the definition
1 files changed, 11 insertions, 0 deletions
-rw-r--r--md-meta.awk11
diff --git a/md-meta.awk b/md-meta.awk
index fea34c3..e4ef2bf 100644
--- a/md-meta.awk
+++ b/md-meta.awk
@@ -6,6 +6,9 @@ function erit(id, href, title) {
print "reference[\"" id "\", \"href\"]=\"" href "\""
print "reference[\"" id "\", \"title\"]=\"\\\"" title "\\\"\""
}
+function efit(id, contents) {
+ print "footnote[\"" id "\"]=\"" contents "\""
+}
title != "" && stopdesc == 0 && /^[A-Za-z]/ {
startedGathering = 1
@@ -53,6 +56,14 @@ title == "" && /^# / {
erit(id, href, reftitle)
}
+/^\[\^[^\]]+\]:/ {
+ match($0, /^\[\^[^\]]+\]:/)
+ footnote_name = substr($0, 3, RLENGTH - 4)
+ footnote_def = substr($0, RSTART + RLENGTH)
+ sub(/^[ \t]*/, "", footnote_def)
+ efit(footnote_name, footnote_def)
+}
+
END {
emit("title", title)
emit("description", desc)