Summary Files Commits Branches @commit @diff @stats
path: root / awk-edits / Icons.awk
diff options
context:
space:
mode:
1 files changed, 27 insertions, 0 deletions
-rw-r--r--awk-edits/Icons.awk27
diff --git a/awk-edits/Icons.awk b/awk-edits/Icons.awk
new file mode 100644
index 0000000..4b3abf7
--- /dev/null
+++ b/awk-edits/Icons.awk
@@ -0,0 +1,27 @@
+# .*html
+#
+# == About ==
+#
+# A collection of ftags that generate an image HTML tag, containing the specified
+# thing. This is done, because these tags need to have specific classes, which is
+# supported in Markdown, but is less flexible and more tedious.
+#
+# -- Placement/Flow --
+#
+# They can reside absolutely anywhere in text.
+
+function flagSub(name, alt) {
+ gsub("&&" name,
+ "<img src=\"/img/" name ".svg\" class=\"flag unzoomable svg\" alt=\"" name "\" height=18>")
+}
+
+/&#38;&#38;gb/ { flagSub("gb", "ENG") }
+/&#38;&#38;bg/ { flagSub("bg", "BGN") }
+
+function articleIconSub(name, filename) {
+ gsub("&#38;&#38;" name,
+ "<img src=\"/img/" filename "\" class=\"article-icons unzoomable\" alt=\"" name "\">")
+}
+
+/&#38;&#38;warn/ { articleIconSub("warn", "dialog-warning.png") }
+/&#38;&#38;question/ { articleIconSub("question", "dialog-question.png") }