diff options
Diffstat (limited to 'www/git.causal.agency/source-filter.sh')
-rw-r--r-- | www/git.causal.agency/source-filter.sh | 19 |
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 |