commit:     ab2bce21ac83e6ad6cc649ef09cd4bae334e4417
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 27 21:35:14 2022 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Tue Dec 27 21:44:34 2022 +0000
URL:        https://gitweb.gentoo.org/proj/pms.git/commit/?id=ab2bce21

Makefile: Use guessable names for section references in HTML output

This replaces the "x1*" fragment identifiers by more predictable ones
with a "chapter", "section", or "appendix" prefix. This is possible
because our section numbers are unique.

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Makefile b/Makefile
index 89fd7a2..c882534 100644
--- a/Makefile
+++ b/Makefile
@@ -54,6 +54,11 @@ pms.html: $(LATEXFILES) pms.bbl $(COMMITINFO)
        @# remove redundant span elements
        LC_ALL=C sed -Ei ':x;/<span(\s+[^>]*)?$$/{N;bx;};'\
        ':y;s,(<span\s+[^>]*>)([^<]*)</span>\1,\1\2,;ty' $@
+       @# guessable names for sections
+       LC_ALL=C sed -Ei \
+         -e 's/("#?)x1-[0-9]*00+([1-9][0-9]?")/\1chapter-\2/g' \
+         -e 's/("#?)x1-[0-9]*00+([1-9][0-9]?(\.[0-9]+)+")/\1section-\2/g' \
+         -e 's/("#?)x1-[0-9]*00+([A-Z](\.[0-9]+)*")/\1appendix-\2/g' $@
 
 pms.bbl: pms.bib $(LATEXFILES) $(COMMITINFO)
        $(aux-clean)

Reply via email to