Summary Files Commits Branches @commit @diff @stats
path: root / meta.awk
diff options
context:
space:
mode:
Commitd792cfc4f2b6b53bf2174c3f3e3fea147524ede8 (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-08-17 17:50:03 +0300
Committer
 Syndamia <kamen@syndamia.com>
2025-08-17 17:50:03 +0300
Files3c9fba8f4c7e848df3c4a6f0d646b74190632b50 /meta.awk
syndamia.com-d792cfc4f2b6b53bf2174c3f3e3fea147524ede8.tar
syndamia.com-d792cfc4f2b6b53bf2174c3f3e3fea147524ede8.tar.gz
syndamia.com-d792cfc4f2b6b53bf2174c3f3e3fea147524ede8.zip
Parent3b29d095293d5e015a491061c190a68f6ab4014b (diff)
feat!: Update dunbar version
The main difference is how the header and footer are handled. Before they were inserted as "include_markup", but now they are as "include".
1 files changed, 33 insertions, 0 deletions
-rw-r--r--meta.awk33
diff --git a/meta.awk b/meta.awk
new file mode 100644
index 0000000..d0aacbb
--- /dev/null
+++ b/meta.awk
@@ -0,0 +1,33 @@
+BEGIN {
+ FS="\t"
+ while ((getline < ENVIRON["META"]) > 0) {
+ if ($1 == "") continue
+ meta_title[$1] = $2 " \\&mdash; Syndamia"
+ meta_description[$1] = $3
+ if (length($3) > 200)
+ print "Description for file \"" $1 "\" is longer than 200 characters!", "Shorten the description field in the \"" ENVIRON["META"] "\" file." > "/dev/stderr"
+ }
+ FS=" "
+
+ HEADER = getfile("./html/header.html")
+ FOOTER = getfile("./html/footer.html")
+
+ for (i = ARGC; i > 0; --i) {
+ if (!ARGV[i]) continue
+
+ start = HEADER
+ FILENAME = substr(ARGV[i], length(ENVIRON["GEN_DIR"]) + 2)
+ gsub(/\$TITLE/, meta_title[FILENAME], start)
+ gsub(/\$DESCRIPTION/, meta_description[FILENAME], start)
+
+ print start getfile(ARGV[i]) FOOTER > ARGV[i]
+ }
+}
+
+function getfile(filename, status, linebuf, filebuf) {
+ while ((status = getline linebuf < filename) > 0)
+ filebuf = filebuf linebuf ORS
+ close(filename)
+ sub(ORS "$", "", filebuf)
+ return filebuf
+}