From e80ba7f43993318b1b55d970598b39a89bcd2a60 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 26 Jan 2020 18:43:41 -0800 Subject: Redesign of the tooling, and new styling for manual pages. This should get us much much closer to proper conformant CSS, and legal HTML5. It also gets rid of some dodgy styling around the old fonts. Finally, we generate the table of contents for all man pages now. This is a rought draft. --- _tools/pubrefman.sh | 59 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 4 deletions(-) (limited to '_tools/pubrefman.sh') diff --git a/_tools/pubrefman.sh b/_tools/pubrefman.sh index 9c33eda4..c545ecf1 100644 --- a/_tools/pubrefman.sh +++ b/_tools/pubrefman.sh @@ -61,7 +61,6 @@ asciidoctor \ -amansource="NNG" \ -amanmanual="NNG Reference Manual" \ -anofooter=yes \ - -atoc=left \ -aicons=font \ -asource-highlighter=pygments \ -alinkcss \ @@ -81,6 +80,10 @@ for f in ${scratch}/adoc/*.adoc; do done index=${scratch}/adoc/index.adoc +toc=${scratch}/html/_toc.html +printf "\n" >> ${toc} asciidoctor \ -q \ -darticle \ -anofooter=yes \ - -atoc=left \ -alinkcss \ -bhtml5 \ -D ${scratch}/html \ ${scratch}/adoc/index.adoc +process_manpage() { + typeset skip=yes + typeset layout=$1 + typeset ver=$2 + typeset title="" + while read line; do + # Look for the body tag, so that we strip off all the pointless + # front matter, because we're going to replace that. We + # don't actually emit the body tags. We also strip out any + # link tags. + case "$line" in + ""*) + title=${line#*'>'} + title=${title%'<'*} + ;; + "<body"*) + printf -- "---\n" + printf "version: ${ver}\n" + printf "layout: ${layout}\n" + printf "title: ${title}\n" + printf -- "---\n" + printf "<main>\n" + skip= + ;; + "</body"*) + printf "</main>\n" + skip=yes + ;; + "<link"*) + # discard it + ;; + *) + if [[ -z "$skip" ]]; then + printf "%s\n" "$line" + fi + ;; + esac + done +} dest=${repo}/man/${ver} mkdir -p ${dest} @@ -118,12 +166,15 @@ for f in ${scratch}/html/*; do # insert the header - HTML only case $f in + */_toc.html) + # SKIP the TOC + ;; *.html) - printf "--" "---\nversion: ${ver}\nlayout: refman\n---\n" > ${f}.new - cat ${f} >> ${f}.new + process_manpage manpage ${ver} < ${f} > ${f}.new mv ${f}.new ${f} ;; *.css) + continue ;; esac -- cgit v1.2.3-70-g09d2