From 660466e13b46c482d5e13d56ea431947ff23c553 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Fri, 15 Dec 2023 10:12:22 +0100 Subject: [PATCH] Improve formatting of mdoc https://github.com/jgm/pandoc/issues/9201 has been fixed, so we can now go through 'man' instead. --- Makefile | 14 +++++++------- README.md | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 1276038..6162f08 100644 --- a/Makefile +++ b/Makefile @@ -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 -# to generate nicer formatting, but runs into another issue: -# https://github.com/jgm/pandoc/issues/9201 -# We'll have to settle for the quote-abusing `mandoc -T markdown` with some -# post-processing and fixups. +# 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 markdown "$<" | \ - tail -n +2 | head -n -2 | \ - sed -E -e 's/--/\\--/g' -e 's/-/-/g' -e 's/(^|[ ,.])([a-zA-Z0-9-]+)\(([1-8])\)/\1[\2(\3)](https:\/\/manned.org\/man\/\2.\3)/g' \ + 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' \ ) >"$@" diff --git a/README.md b/README.md index ae31e66..1cbee7c 100644 --- a/README.md +++ b/README.md @@ -8,5 +8,5 @@ Build-time: - curl - Perl (+ Pod::Simple) - TUWF -- pandoc +- pandoc (>= 3.1.10 for better man page formatting) - mandoc