Skip to content

Add the ability to inject HTML templates and stylesheets. #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ DIFFBASE=""
PDF_ENGINE=xelatex
CROSSREF_TYPE="iso"
DO_AUTO_BACKMATTER="yes"
TEMPLATE="tcg.tex"
TEMPLATE_PDF="tcg.tex"
TEMPLATE_HTML=""
HTML_STYLESHEET_ARGS=""
CSL=""


Expand Down Expand Up @@ -45,7 +47,9 @@ print_usage() {
echo "Options:"
echo
echo "Output Control (note that output file names are always relative to the current directory)"
echo " --template=template.tex: override the template."
echo " --template=template.tex: override the PDF template."
echo " --template_html=template.html: override the HTML template."
echo " --html_stylesheet=style.css: pass additional CSS (may be invoked multiple times)."
echo " --docx=output: enable output of docx and specify the output file name."
echo " --crossref=(iso|tcg): set cross-reference style."
echo " --pdf=output: enable output of pdf and specify the output file name."
Expand Down Expand Up @@ -74,7 +78,7 @@ print_usage() {
}


if ! options=$(getopt --longoptions=help,puppeteer,gitversion,gitstatus,nogitversion,table_rules,plain_quotes,versioned_filenames,pr_number:,pr_repo:,diffbase:,pdf:,diffpdf:,difftex:,diffpdflog:,latex:,pdflog:,pdf_engine:,template:,reference_doc:,docx:,crossref:,html:,resourcedir:,noautobackmatter,csl: --options="" -- "$@"); then
if ! options=$(getopt --longoptions=help,puppeteer,gitversion,gitstatus,nogitversion,table_rules,plain_quotes,versioned_filenames,pr_number:,pr_repo:,diffbase:,pdf:,diffpdf:,difftex:,diffpdflog:,latex:,pdflog:,pdf_engine:,template:,template_html:,html_stylesheet:,reference_doc:,docx:,crossref:,html:,resourcedir:,noautobackmatter,csl: --options="" -- "$@"); then
echo "Incorrect options provided"
print_usage
exit 1
Expand Down Expand Up @@ -153,7 +157,15 @@ while true; do
shift 2
;;
--template)
TEMPLATE="${2}"
TEMPLATE_PDF="${2}"
shift 2
;;
--template_html)
TEMPLATE_HTML="${2}"
shift 2
;;
--html_stylesheet)
HTML_STYLESHEET_ARGS+=" --css ${2}"
shift 2
;;
--reference_doc)
Expand Down Expand Up @@ -697,7 +709,7 @@ do_latex() {
local cmd=(pandoc
--standalone
--no-highlight
--template=${TEMPLATE}
--template=${TEMPLATE_PDF}
--lua-filter=mermaid-filter.lua
--lua-filter=aasvg-filter.lua
--lua-filter=informative-sections.lua
Expand Down Expand Up @@ -851,6 +863,8 @@ do_html() {
-V toccolor=blue
--embed-resources
--standalone
--template=${TEMPLATE_HTML}
${HTML_STYLESHEET_ARGS}
--lua-filter=mermaid-filter.lua
--lua-filter=aasvg-filter.lua
--lua-filter=parse-html.lua
Expand Down
Loading