Summary Files Commits Branches @commit @diff @stats
path: root / md-meta.awk
diff options
context:
space:
mode:
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)