summary refs log tree commit diff
path: root/www/git.causal.agency/source-filter.sh
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-01-13 22:50:32 +0000
committerJune McEnroe <june@causal.agency>2021-01-13 22:50:32 +0000
commit9b00ec17f2fd2d4aee1819fd85cd1f9a3ee51550 (patch)
treed150d21355d82290ca1427fa5aad0178821a1b62 /www/git.causal.agency/source-filter.sh
parentTry to return make substitutions as single tokens (diff)
downloadsrc-9b00ec17f2fd2d4aee1819fd85cd1f9a3ee51550.tar.gz
src-9b00ec17f2fd2d4aee1819fd85cd1f9a3ee51550.zip
Switch git.causal.agency to hilex and htagml
Still missing a shell lexer in hilex, but well... it's shell.
Diffstat (limited to '')
-rw-r--r--www/git.causal.agency/source-filter.sh19
1 files changed, 18 insertions, 1 deletions
diff --git a/www/git.causal.agency/source-filter.sh b/www/git.causal.agency/source-filter.sh
index 4febc2e0..924744bd 100644
--- a/www/git.causal.agency/source-filter.sh
+++ b/www/git.causal.agency/source-filter.sh
@@ -1,3 +1,20 @@
 #!/bin/sh
+set -eu
 
-exec /usr/local/libexec/hi -t -n "$1" -f html -o anchor
+ctags=/usr/bin/ctags
+hilex=/usr/local/libexec/hilex
+htagml=/usr/local/libexec/htagml
+
+case "$1" in
+	(*.[chlmy])
+		src=$(mktemp -t source-filter)
+		tag=$(mktemp -t source-filter)
+		trap 'rm -f "${src}" "${tag}"' EXIT
+		cat >"${src}"
+		$ctags -w -f "${tag}" "${src}"
+		$hilex -n "$1" -f html "${src}" | $htagml -i -f "${tag}" "${src}"
+		;;
+	(*)
+		exec $hilex -t -n "$1" -f html
+		;;
+esac