summary refs log tree commit diff
path: root/www/git.causal.agency/source-filter.sh
blob: be04e0c1abe6532b61d83a60342eb1191499b557 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
set -eu

ctags=/usr/bin/ctags
hilex=/usr/local/libexec/hilex
htagml=/usr/local/libexec/htagml

case "$1" in
	(*.[chlmy])
		tmp=$(mktemp -d -t source-filter)
		trap 'rm -fr "${tmp}"' EXIT
		cd "${tmp}"
		cat >"$1"
		touch tags
		$ctags -w "$1"
		$hilex -f html "$1" | $htagml -i "$1"
		;;
	(*)
		exec $hilex -t -n "$1" -f html
		;;
esac