diff options
author | June McEnroe <june@causal.agency> | 2019-12-18 23:37:45 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-12-18 23:39:54 -0500 |
commit | b6ff1659e5cb70a3b3a9d7ecb0c87683a54baa7d (patch) | |
tree | a2d77302fc4206d8dd7508e0f38a2d223c262a28 /www | |
parent | Customize cgit CSS (diff) | |
download | src-b6ff1659e5cb70a3b3a9d7ecb0c87683a54baa7d.tar.gz src-b6ff1659e5cb70a3b3a9d7ecb0c87683a54baa7d.zip |
Hide line numbers when rendering mdoc
Hack: output an extra <td> after rendering mdoc so that line numbers can be hidden based on there being three. This required splitting source-filter and about-filter since on about pages there is no table.
Diffstat (limited to 'www')
-rw-r--r-- | www/git.causal.agency/Makefile | 2 | ||||
-rw-r--r-- | www/git.causal.agency/about-filter.sh | 13 | ||||
-rw-r--r-- | www/git.causal.agency/cgitrc | 2 | ||||
-rw-r--r-- | www/git.causal.agency/custom.css | 4 | ||||
-rw-r--r-- | www/git.causal.agency/source-filter.sh | 6 |
5 files changed, 21 insertions, 6 deletions
diff --git a/www/git.causal.agency/Makefile b/www/git.causal.agency/Makefile index bba51f40..8b87920f 100644 --- a/www/git.causal.agency/Makefile +++ b/www/git.causal.agency/Makefile @@ -3,7 +3,7 @@ WWW = /usr/local/www/cgit LIBEXEC = /usr/local/libexec BIN = ../../bin -BINS = source-filter ttpre hi +BINS = about-filter source-filter ttpre hi install: cgitrc custom.css ${BINS} install -m 644 cgitrc ${ETC} diff --git a/www/git.causal.agency/about-filter.sh b/www/git.causal.agency/about-filter.sh new file mode 100644 index 00000000..216c86e9 --- /dev/null +++ b/www/git.causal.agency/about-filter.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +case "$1" in + (*.[1-9]) + /usr/bin/mandoc -T utf8 \ + | /usr/local/libexec/ttpre \ + | /usr/bin/sed -E \ + 's,([a-z0-9_-]+)[(]([1-9])[)],<a href="\1.\2">&</a>,g' + ;; + (*) + exec /usr/local/libexec/hi -l text -f html + ;; +esac diff --git a/www/git.causal.agency/cgitrc b/www/git.causal.agency/cgitrc index 4a1aa904..0578ecbb 100644 --- a/www/git.causal.agency/cgitrc +++ b/www/git.causal.agency/cgitrc @@ -14,7 +14,7 @@ branch-sort=age css=/custom.css email-filter=/usr/local/libexec/cgit-email -about-filter=/usr/local/libexec/source-filter +about-filter=/usr/local/libexec/about-filter source-filter=/usr/local/libexec/source-filter readme=:README.7 diff --git a/www/git.causal.agency/custom.css b/www/git.causal.agency/custom.css index 66cdc185..a5095054 100644 --- a/www/git.causal.agency/custom.css +++ b/www/git.causal.agency/custom.css @@ -35,6 +35,10 @@ 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; diff --git a/www/git.causal.agency/source-filter.sh b/www/git.causal.agency/source-filter.sh index ce9e3f8b..868859b4 100644 --- a/www/git.causal.agency/source-filter.sh +++ b/www/git.causal.agency/source-filter.sh @@ -2,10 +2,8 @@ case "$1" in (*.[1-9]) - /usr/bin/mandoc -T utf8 \ - | /usr/local/libexec/ttpre \ - | /usr/bin/sed -E \ - 's,([a-z0-9_-]+)[(]([1-9])[)],<a href="\1.\2">&</a>,g' + /usr/local/libexec/about-filter "$@" + printf '</code></pre></td><td><pre><code>' ;; (*) exec /usr/local/libexec/hi -t -n "$1" -f html -o anchor |