Summary Files Commits Branches @commit @diff @stats
path: root / ext
diff options
context:
space:
mode:
Commitf6d40fff04fcf28e3a9f79afc3f00c6b6ac7f383 (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-07-21 07:27:29 +0300
Committer
 Syndamia <kamen@syndamia.com>
2025-07-21 07:45:00 +0300
Files9e2c8be8cd766f60ba022cfb8c90a78b549291ae /ext
syndamia.com-f6d40fff04fcf28e3a9f79afc3f00c6b6ac7f383.tar
syndamia.com-f6d40fff04fcf28e3a9f79afc3f00c6b6ac7f383.tar.gz
syndamia.com-f6d40fff04fcf28e3a9f79afc3f00c6b6ac7f383.zip
Parentfe054ac33b1d28ae16dbae9305651188f0b22608 (diff)
feat(src/ext): Replace icons.du with icons.awk
Adding the substitutions in an AWK BEGIN block is much faster than with a dunbar file. It also eliminates the HTML file, generated in ext. However, this does bring up the question whether having cross-file definitions is a bug or a feature. It would be better for dunbar implementation compatibility.
2 files changed, 19 insertions, 35 deletions
-rw-r--r--ext/icons.awk19
-rw-r--r--ext/icons.du35
diff --git a/ext/icons.awk b/ext/icons.awk
new file mode 100644
index 0000000..027cc75
--- /dev/null
+++ b/ext/icons.awk
@@ -0,0 +1,19 @@
+BEGIN {
+ flagdef("gb", "ENG")
+ flagdef("bg", "BGN")
+
+ ftdef("ft-photo", "&#xeb0a;")
+ ftdef("ft-text", "&#xeaa2;")
+ ftdef("ft-zip", "&#xed4e;")
+ ftdef("ft-movie", "&#xeafa;")
+ ftdef("ft-markdown", "&#xec41;")
+ ftdef("ft-browser", "&#xebb7;")
+}
+
+function flagdef(flag, alt) {
+ substitutions[flag] = "<img src=\"/img/" flag ".svg\" class=\"flag unzoomable svg\" alt=\"" alt "\" height=18>"
+}
+
+function ftdef(ft, char) {
+ substitutions[ft] = "<span class=\"file-type-icon\">" char "</span>"
+}
diff --git a/ext/icons.du b/ext/icons.du
deleted file mode 100644
index 4878bc7..0000000
--- a/ext/icons.du
+++ /dev/null
@@ -1,35 +0,0 @@
-'define flagdef 'define [$flag] <img src="/img/[$flag].svg" class="flag unzoomable svg" alt="[$alt]" height=18>
-
- 'define flag gb
- 'define alt ENG
- [$flagdef]
-
- 'define flag bg
- 'define alt BGN
- [$flagdef]
-
-'define ftdef 'define [$ft] <span class="file-type-icon">[$char]</span>
-
- 'define ft ft-photo
- 'define char &#xeb0a;
- [$ftdef]
-
- 'define ft ft-text
- 'define char &#xeaa2;
- [$ftdef]
-
- 'define ft ft-zip
- 'define char &#xed4e;
- [$ftdef]
-
- 'define ft ft-movie
- 'define char &#xeafa;
- [$ftdef]
-
- 'define ft ft-markdown
- 'define char &#xec41;
- [$ftdef]
-
- 'define ft ft-browser
- 'define char &#xebb7;
- [$ftdef]