Drop mandoc, pandoc can read mdoc now; styling; guestbook

This commit is contained in:
Yorhel 2025-02-12 13:22:00 +01:00
parent 76b8f42f1d
commit af1f4c0dd2
7 changed files with 68 additions and 33 deletions

View file

@ -5,7 +5,7 @@
# If no $URL is given or the $URL is '-', then the input file is assumed to be
# in dat/, otherwise it will be fetched from $URL.
#
# A $title should be given for .pod, .log and .mdoc files, it is ignored for
# A $title should be given for .pod, .log, .mdoc and .man files, it is ignored for
# .md files because those already have a title embedded in the file.
#
# Supported file types:
@ -13,7 +13,7 @@
# .pod: Perl's Plain Old Documentation, converted through HTML into a .md
# file which is then converted into .html again with the proper template.
# .log: A ChangeLog-formatted file, converted through .md into .html.
# .mdoc: mandoc manual page, converted through .md into .html.
# .mdoc / .man: manual page, converted through .md into .html.
PAGES=\
"contributing.md"\
"doc.md"\
@ -75,14 +75,14 @@ PAGES=\
"ncdu/man/1_11.pod https://g.blicky.net/ncdu.git/plain/doc/ncdu.pod?h=v1.11 Ncdu 1.11 Manual"\
"ncdu/man/1_10.pod https://g.blicky.net/ncdu.git/plain/doc/ncdu.pod?h=v1.10 Ncdu 1.10 Manual"\
"ncdu/man/1_9.pod https://g.blicky.net/ncdu.git/plain/doc/ncdu.pod?h=v1.9 Ncdu 1.9 Manual"\
"ncdu/man/1_8.mdoc https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.8 Ncdu 1.8 Manual"\
"ncdu/man/1_7.mdoc https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.7 Ncdu 1.7 Manual"\
"ncdu/man/1_6.mdoc https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.6 Ncdu 1.6 Manual"\
"ncdu/man/1_5.mdoc https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.5 Ncdu 1.5 Manual"\
"ncdu/man/1_4.mdoc https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.4 Ncdu 1.4 Manual"\
"ncdu/man/1_3.mdoc https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.3 Ncdu 1.3 Manual"\
"ncdu/man/1_2.mdoc https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.2 Ncdu 1.2 Manual"\
"ncdu/man/1_1.mdoc https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.1 Ncdu 1.1 Manual"\
"ncdu/man/1_8.man https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.8 Ncdu 1.8 Manual"\
"ncdu/man/1_7.man https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.7 Ncdu 1.7 Manual"\
"ncdu/man/1_6.man https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.6 Ncdu 1.6 Manual"\
"ncdu/man/1_5.man https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.5 Ncdu 1.5 Manual"\
"ncdu/man/1_4.man https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.4 Ncdu 1.4 Manual"\
"ncdu/man/1_3.man https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.3 Ncdu 1.3 Manual"\
"ncdu/man/1_2.man https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.2 Ncdu 1.2 Manual"\
"ncdu/man/1_1.man https://g.blicky.net/ncdu.git/plain/doc/ncdu.1?h=v1.1 Ncdu 1.1 Manual"\
"ncdu/scr.md"\
"nginx-confgen.md"\
"nginx-confgen/changes.log https://g.blicky.net/nginx-confgen.git/plain/ChangeLog nginx-confgen Release History"\
@ -141,8 +141,11 @@ CHANGES_MD := $(shell for i in ${PAGES}; do echo "$$i" | grep -Eo '^[^ ]+\.log'
# List of .md files generated from .mdoc files
MDOC_MD := $(shell for i in ${PAGES}; do echo "$$i" | grep -Eo '^[^ ]+\.mdoc' | sed -E 's/(.+)\.mdoc$$/dat\/\1.md/'; done)
# List of .md files generated from .man files
MAN_MD := $(shell for i in ${PAGES}; do echo "$$i" | grep -Eo '^[^ ]+\.man' | sed -E 's/(.+)\.man$$/dat\/\1.md/'; done)
# All fetched & generated files
CLEAN := dat/download.md ${FETCH} ${POD_MD} ${CHANGES_MD} ${MDOC_MD} ${HTML_OUT} ${FEEDS}
CLEAN := dat/download.md ${FETCH} ${POD_MD} ${CHANGES_MD} ${MDOC_MD} ${MAN_MD} ${HTML_OUT} ${FEEDS}
.PHONY: all clean
@ -180,18 +183,15 @@ ${CHANGES_MD}: dat/%.md: dat/%.log mkchangelog.pl
@./mkchangelog.pl "$*" "${shell for i in ${PAGES}; do case "$$i" in "$*.log "*) echo "$$i" | sed -E 's/[^ ]+ +[^ ]+ +//';; esac; done}" <"$<" >"$@"
# pandoc doesn't support mdoc directly. Going through a `mandoc -T man` tends
# to generate nicer formatting than `mandoc -T markdown`, though any links
# appear to get lost. Going through `mandoc -T html` is also an option, but
# pandoc makes quite a mess of that.
${MDOC_MD}: dat/%.md: dat/%.mdoc
@echo "MDOC $*"
@(echo "% ${shell for i in ${PAGES}; do case "$$i" in "$*.mdoc "*) echo "$$i" | sed -E 's/[^ ]+ +[^ ]+ +//';; esac; done}";\
mandoc -T man "$<" |\
pandoc -f man -t markdown |\
sed -E -e 's/(^|[ ,.])([a-zA-Z0-9-]+)\(([1-8])\)/\1[\2(\3)](https:\/\/manned.org\/man\/\2.\3)/g' \
-e 's/\*\*(https:[^[:space:]]+)\*\*/[\1](\1)/g' \
) >"$@"
pandoc -f mdoc -t markdown $< | ./mdocproc.pl ) >"$@"
${MAN_MD}: dat/%.md: dat/%.man
@echo "MAN $*"
@(echo "% ${shell for i in ${PAGES}; do case "$$i" in "$*.man "*) echo "$$i" | sed -E 's/[^ ]+ +[^ ]+ +//';; esac; done}";\
pandoc -f man -t markdown $< | ./mdocproc.pl ) >"$@"
dat/download.md: mkdlpage.pl pub/download/*.sha256