diff options
author | June McEnroe <june@causal.agency> | 2021-01-12 16:55:34 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-01-12 16:55:34 -0500 |
commit | 4708b1750f705155c557cf9ca3f2b03967c47696 (patch) | |
tree | 9c963013342614b581f91c14c40e22cebeca41e3 | |
parent | Add htagml (diff) | |
download | src-4708b1750f705155c557cf9ca3f2b03967c47696.tar.gz src-4708b1750f705155c557cf9ca3f2b03967c47696.zip |
Use mandoc and htagml for bin html
-rw-r--r-- | bin/.gitignore | 1 | ||||
-rw-r--r-- | bin/Makefile | 16 | ||||
-rw-r--r-- | bin/html.sh | 65 |
3 files changed, 55 insertions, 27 deletions
diff --git a/bin/.gitignore b/bin/.gitignore index 2bfab38f..02f47efe 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -14,6 +14,7 @@ glitch hi hnel htagml +htmltags modem nudge open diff --git a/bin/Makefile b/bin/Makefile index f858d483..5820051c 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -93,10 +93,10 @@ psf2png.o scheme.o: png.h scheme.h: scheme ./scheme -c > scheme.h -tags: *.h *.c - ctags -w *.h *.c +tags: *.[chly] + ctags -tw *.[chly] -IGNORE = *.o *.html ${BINS_ALL} ${LINKS} scheme.h tags +IGNORE = *.o *.html ${BINS_ALL} ${LINKS} scheme.h tags htmltags .gitignore: Makefile echo config.mk '${IGNORE}' | tr ' ' '\n' | sort > .gitignore @@ -125,7 +125,11 @@ WEBROOT = /usr/local/www/causal.agency html: ${HTMLS} @true -${HTMLS}: html.sh scheme hi ttpre +${HTMLS}: html.sh scheme ttpre htagml htmltags + +htmltags: *.[chly] + rm -f $@ + for f in *.[chly]; do ctags -atw -f $@ $$f; done .SUFFIXES: .html @@ -145,9 +149,7 @@ ${HTMLS}: html.sh scheme hi ttpre sh html.sh $< man1/${<:.pl=.1} > $@ index.html: Makefile README.7 - sh html.sh Makefile README.7 \ - | sed -E 's,([a-z0-9-]+)[(][1-9][)],<a href="\1.html">&</a>,' \ - > index.html + sh html.sh Makefile README.7 > $@ install-html: ${HTMLS} install -d ${WEBROOT}/bin diff --git a/bin/html.sh b/bin/html.sh index e96a7210..600d37f5 100644 --- a/bin/html.sh +++ b/bin/html.sh @@ -10,32 +10,57 @@ cat <<EOF <!DOCTYPE html> <title>${src}</title> <style> -$(./scheme -st) +$(./scheme -s) + +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 { border-collapse: collapse; } +table.Nm code.Nm { padding-right: 1ch; } +table.foot { margin-top: 1em; } + html { + line-height: 1.25em; font-family: monospace; - color: var(--ansi17); - background-color: var(--ansi16); + background-color: var(--ansi0); + color: var(--ansi7); + -moz-tab-size: 4; + tab-size: 4; +} +body { + max-width: 80ch; + margin: 1em auto; + padding: 0 1ch; } a { color: var(--ansi4); } a:visited { color: var(--ansi5); } -pre.hi { - -moz-tab-size: 4; - tab-size: 4; +a.permalink, a.tag { + color: var(--ansi6); + text-decoration: none; +} +a.permalink code:target, +h1.Sh:target a.permalink, +h2.Ss:target a.permalink, +a.tag:target { + color: var(--ansi3); + outline: none; } -.hi.Keyword { color: var(--ansi7); } -.hi.Macro { color: var(--ansi2); } -.hi.Tag { color: inherit; text-decoration: underline; } -.hi.Tag:target { color: var(--ansi11); outline: none; } -.hi.String { color: var(--ansi6); } -.hi.Format { color: var(--ansi14); } -.hi.Interp { color: var(--ansi3); } -.hi.Comment { color: var(--ansi4); } -.hi.Todo { color: var(--ansi12); } -.hi.DiffOld { color: var(--ansi1); } -.hi.DiffNew { color: var(--ansi2); } </style> -<a href="${GitURL}/${src}">${src} in git</a> EOF -[ -f "$man" ] && man -P cat "${PWD}/${man}" | ./ttpre -./hi -t -f html -o anchor "$src" +opts='fragment' +[ "${man}" = "README.7" ] && opts="${opts},man=%N.html" +mandoc -T html -O "${opts}" "${man}" +cat <<EOF +<p> +<a href="${GitURL}/${src}">${src} in git</a> +EOF +./htagml -p -f htmltags "${src}" |