Transition to Python script for HTML generation, also correcting pandoc theme issue

This commit is contained in:
Robin Stuart 2022-07-19 17:11:33 +01:00
parent bc0c745a93
commit 415bce003f
4 changed files with 10 additions and 231 deletions

View file

@ -7,7 +7,6 @@
SOURCE = manual.pmd
OUT_PDF = manual.pdf
OUT_TXT = manual.txt
HIGHLIGHT_THEME = vs.theme
INC_HEADER_PDF = inc_header_pdf.tex
INC_BEFORE_BODY_PDF = inc_before_body_pdf.tex
INCLUDES_PDF = $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF)
@ -136,7 +135,7 @@ MAIN_FONT = mainfont="TeX Gyre Pagella"
MONO_FONT = monofont="Liberation Mono"
CJK_FONT = CJKmainfont="WenQuanYi Micro Hei Mono"
PDF_OPTS = --pdf-engine=xelatex --filter pandoc-tablenos -M tablenos-warning-level=0 \
--highlight-style=$(HIGHLIGHT_THEME) -V colorlinks -V geometry:margin=20mm -V papersize=a4 -V csquotes=true --dpi=300
--highlight-style=haddock -V colorlinks -V geometry:margin=20mm -V papersize=a4 -V csquotes=true --dpi=300
TEX_MAN_PAGE = zint.1.tex
TXT_OPTS = --filter pandoc-tablenos -M tablenos-warning-level=0 --columns 80 --eol=lf -t plain
MAN_PAGE_OPTS = -s -t man
@ -169,21 +168,3 @@ $(OUT_MAN_PAGE) : $(SOURCE_MAN_PAGE) Makefile
pandoc $(SOURCE_MAN_PAGE) -f markdown \
$(MAN_PAGE_OPTS) \
-o $(OUT_MAN_PAGE)
# HTML demo
OUT_HTML = manual.html
HTML_OPTS = --filter pandoc-tablenos -M tablenos-warning-level=0 --highlight-style=$(HIGHLIGHT_THEME) \
--eol=lf -s -t html
$(OUT_HTML) : $(SOURCE) $(SOURCE_MAN_PAGE) Makefile
pandoc $(SOURCE) $(SOURCE_MAN_PAGE) -f markdown --toc --toc-depth=4 \
-V $(MAIN_FONT) -V $(MONO_FONT) -V $(CJK_FONT) \
$(HTML_OPTS) \
-o $(OUT_HTML)
# Indent Man Page sections in TOC & change Man Page sections h1 -> h2
sed -i \
-e 's/\(Man Page<\/a>\)<\/li>/\1<ul>/' \
-e 's/\(AUTHORS<\/a><\/li>\)/\1<\/ul><\/li>/' \
-e 's/^<h1\([^>]*>[A-Z][A-Z ]*<\/\)h1>$$/<h2\1h2>/' \
$(OUT_HTML)

View file

@ -3907,6 +3907,8 @@ countries.
Mac and macOS are trademarks of Apple Inc., registered in the U.S. and other
countries.
The Zint logo derived from “SF Planetary Orbiter” font by ShyFoundary
Zint.org.uk website design and hosting provided by Robert Elliott.
7.2 Patent Issues

View file

@ -1,211 +0,0 @@
{
"text-color": null,
"background-color": "#fafafa",
"line-number-color": "#aaaaaa",
"line-number-background-color": null,
"text-styles": {
"Alert": {
"text-color": "#ff0000",
"background-color": null,
"bold": true,
"italic": false,
"underline": false
},
"Annotation": {
"text-color": "#60a0b0",
"background-color": null,
"bold": true,
"italic": true,
"underline": false
},
"Attribute": {
"text-color": "#7d9029",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"BaseN": {
"text-color": "#40a070",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"BuiltIn": {
"text-color": null,
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Char": {
"text-color": "#4070a0",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Comment": {
"text-color": "#60a0b0",
"background-color": null,
"bold": false,
"italic": true,
"underline": false
},
"CommentVar": {
"text-color": "#60a0b0",
"background-color": null,
"bold": true,
"italic": true,
"underline": false
},
"Constant": {
"text-color": "#880000",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"ControlFlow": {
"text-color": "#007020",
"background-color": null,
"bold": true,
"italic": false,
"underline": false
},
"DataType": {
"text-color": "#902000",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"DecVal": {
"text-color": "#40a070",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Documentation": {
"text-color": "#ba2121",
"background-color": null,
"bold": false,
"italic": true,
"underline": false
},
"Error": {
"text-color": "#ff0000",
"background-color": null,
"bold": true,
"italic": false,
"underline": false
},
"Extension": {
"text-color": null,
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Float": {
"text-color": "#40a070",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Function": {
"text-color": "#06287e",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Import": {
"text-color": null,
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Information": {
"text-color": "#60a0b0",
"background-color": null,
"bold": true,
"italic": true,
"underline": false
},
"Keyword": {
"text-color": "#007020",
"background-color": null,
"bold": true,
"italic": false,
"underline": false
},
"Operator": {
"text-color": "#666666",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Other": {
"text-color": "#007020",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Preprocessor": {
"text-color": "#bc7a00",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"SpecialChar": {
"text-color": "#4070a0",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"SpecialString": {
"text-color": "#bb6688",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"String": {
"text-color": "#4070a0",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Variable": {
"text-color": "#19177c",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"VerbatimString": {
"text-color": "#4070a0",
"background-color": null,
"bold": false,
"italic": false,
"underline": false
},
"Warning": {
"text-color": "#60a0b0",
"background-color": null,
"bold": true,
"italic": true,
"underline": false
}
}
}

View file

@ -1,3 +1,10 @@
# This script takes the output from pandoc and converts it into the format needed by
# the website at Zint.org.uk
#
# Warning: This code is ugly... but it saves days of manual effort updating the website.
#
# Copyright (C) 2022 <rstuart114@gmail.com>
# Works out which tags should influence indentation and puts them on their own line
def isolate_tag(tag):
global stage