Improve formatting of mdoc

https://github.com/jgm/pandoc/issues/9201 has been fixed, so we can now
go through 'man' instead.
This commit is contained in:
Yorhel 2023-12-15 10:12:22 +01:00
parent c39079c121
commit 660466e13b
2 changed files with 8 additions and 8 deletions

View file

@ -141,16 +141,16 @@ ${CHANGES_MD}: dat/%.md: dat/%.log mkchangelog.pl
# pandoc doesn't support mdoc directly. Going through a `mandoc -T man` tends # pandoc doesn't support mdoc directly. Going through a `mandoc -T man` tends
# to generate nicer formatting, but runs into another issue: # to generate nicer formatting than `mandoc -T markdown`, though any links
# https://github.com/jgm/pandoc/issues/9201 # appear to get lost. Going through `mandoc -T html` is also an option, but
# We'll have to settle for the quote-abusing `mandoc -T markdown` with some # pandoc makes quite a mess of that.
# post-processing and fixups.
${MDOC_MD}: dat/%.md: dat/%.mdoc ${MDOC_MD}: dat/%.md: dat/%.mdoc
@echo "MDOC $*" @echo "MDOC $*"
@(echo "% ${shell for i in ${PAGES}; do case "$$i" in "$*.mdoc "*) echo "$$i" | sed -E 's/[^ ]+ +[^ ]+ +//';; esac; done}";\ @(echo "% ${shell for i in ${PAGES}; do case "$$i" in "$*.mdoc "*) echo "$$i" | sed -E 's/[^ ]+ +[^ ]+ +//';; esac; done}";\
mandoc -T markdown "$<" | \ mandoc -T man "$<" |\
tail -n +2 | head -n -2 | \ pandoc -f man -t markdown |\
sed -E -e 's/-&#45;/\\--/g' -e 's/&#45;/-/g' -e 's/(^|[ ,.])([a-zA-Z0-9-]+)\(([1-8])\)/\1[\2(\3)](https:\/\/manned.org\/man\/\2.\3)/g' \ 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' \
) >"$@" ) >"$@"

View file

@ -8,5 +8,5 @@ Build-time:
- curl - curl
- Perl (+ Pod::Simple) - Perl (+ Pod::Simple)
- TUWF - TUWF
- pandoc - pandoc (>= 3.1.10 for better man page formatting)
- mandoc - mandoc