From 4aa7728283f4e0ece89437bf7933e8293063c830 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Wed, 8 Jan 2020 01:58:44 +0000 Subject: Use mandoc -T html for about-filter This also makes source-filter show mdoc source again and removes the dependency on ttpre entirely. I copied in the inline stylesheet mandoc outputs without -O fragment and added some customizations. --- www/git.causal.agency/.gitignore | 1 - www/git.causal.agency/Makefile | 8 ++------ www/git.causal.agency/about-filter.sh | 6 +----- www/git.causal.agency/custom.css | 29 +++++++++++++++++++++++++---- www/git.causal.agency/source-filter.sh | 11 +---------- 5 files changed, 29 insertions(+), 26 deletions(-) diff --git a/www/git.causal.agency/.gitignore b/www/git.causal.agency/.gitignore index d53ebc26..8d20f25d 100644 --- a/www/git.causal.agency/.gitignore +++ b/www/git.causal.agency/.gitignore @@ -1,4 +1,3 @@ about-filter hi source-filter -ttpre diff --git a/www/git.causal.agency/Makefile b/www/git.causal.agency/Makefile index 8b87920f..28e08ba5 100644 --- a/www/git.causal.agency/Makefile +++ b/www/git.causal.agency/Makefile @@ -3,20 +3,16 @@ WWW = /usr/local/www/cgit LIBEXEC = /usr/local/libexec BIN = ../../bin -BINS = about-filter source-filter ttpre hi +BINS = about-filter source-filter hi install: cgitrc custom.css ${BINS} install -m 644 cgitrc ${ETC} install -m 644 custom.css ${WWW} install ${BINS} ${LIBEXEC} -ttpre hi: +hi: ${BIN}/hi.c ${MAKE} -C ${BIN} $@ cp ${BIN}/$@ $@ -ttpre: ${BIN}/ttpre.c - -hi: ${BIN}/hi.c - clean: rm -f ${BINS} diff --git a/www/git.causal.agency/about-filter.sh b/www/git.causal.agency/about-filter.sh index 26a52648..c7161006 100644 --- a/www/git.causal.agency/about-filter.sh +++ b/www/git.causal.agency/about-filter.sh @@ -1,12 +1,8 @@ #!/bin/sh -export LANG=en_US.UTF-8 case "$1" in (*.[1-9]) - /usr/bin/mandoc \ - | /usr/local/libexec/ttpre \ - | /usr/bin/sed -E \ - 's,([a-z0-9_-]+)[(]([1-9])[)],&,g' + /usr/bin/mandoc -T html -O fragment,man=%N.%S,includes=../tree/%I ;; (*) exec /usr/local/libexec/hi -l text -f html diff --git a/www/git.causal.agency/custom.css b/www/git.causal.agency/custom.css index 9d7b3a0b..921cf09e 100644 --- a/www/git.causal.agency/custom.css +++ b/www/git.causal.agency/custom.css @@ -39,16 +39,17 @@ div#cgit table.list tr.nohover-highlight:hover:nth-child(even) { background: inherit; } -div#cgit table.blob td.linenumbers:nth-last-child(3) { - display: none; -} - div#cgit table.blob td.linenumbers a:target { color: goldenrod; text-decoration: underline; outline: none; } +div#cgit div#summary { + max-width: 80ch; +} + +/* from hi(1) */ div#cgit .hi.Keyword { color: dimgray; } div#cgit .hi.Macro { color: green; } div#cgit .hi.Tag { color: inherit; text-decoration: underline; } @@ -60,3 +61,23 @@ div#cgit .hi.Todo { color: navy; font-weight: bold; } div#cgit .hi.DiffOld { color: red; } div#cgit .hi.DiffNew { color: green; } div#cgit .hi.Tag:target { color: goldenrod; outline: none; } + +/* from mandoc(1) */ +table.head, table.foot { width: 100%; } +td.head-rtitle, td.foot-os { text-align: right; } +td.head-vol { text-align: center; } +div.Pp { margin: 1ex 0ex; } +div.Nd, div.Bf, div.Op { display: inline; } +span.Pa, span.Ad { font-style: italic; } +span.Ms { font-weight: bold; } +dl.Bl-diag > dt { font-weight: bold; } +code.Nm, code.Fl, code.Cm, code.Ic, code.In, code.Fd, code.Fn, +code.Cd { font-weight: bold; font-family: inherit; } + +table.Nm td:first-child { padding-right: 1ch; } +code.Fl { white-space: nowrap; } +dl.Bl-tag dt { margin-top: 1em; } +div.Bd-indent { margin-left: 4ch; } +table.foot { margin-top: 1em; } + +div#cgit a.permalink { color: inherit; } diff --git a/www/git.causal.agency/source-filter.sh b/www/git.causal.agency/source-filter.sh index 5c5eb734..4febc2e0 100644 --- a/www/git.causal.agency/source-filter.sh +++ b/www/git.causal.agency/source-filter.sh @@ -1,12 +1,3 @@ #!/bin/sh -export LANG=en_US.UTF-8 -case "$1" in - (*.[1-9]) - /usr/local/libexec/about-filter "$@" - printf '
'
-		;;
-	(*)
-		exec /usr/local/libexec/hi -t -n "$1" -f html -o anchor
-		;;
-esac
+exec /usr/local/libexec/hi -t -n "$1" -f html -o anchor
-- 
cgit 1.4.1