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

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