@@ -532,6 +532,9 @@ if [ "${BLOCK_QUOTES_ARE_INFORMATIVE_TEXT}" == "yes" ]; then
532532fi
533533
534534# Use sed to perform some basic fixups on certain input files.
535+ #
536+ # If the second argument is provided and is "html", strip out `\listoffigures` and `\listoftables`,
537+ # as these don't render correctly in HTML.
535538do_md_fixups () {
536539 local input=$1
537540 # \newpage is rendered as the string "\newpage" in GitHub markdown.
@@ -563,6 +566,15 @@ do_md_fixups() {
563566 EOF
564567 fi
565568 fi
569+
570+ # These don't render correctly:
571+ # - The lists are raw text and not clickable entries.
572+ # - The "List of Figures" and "List of Tables" headers show up in the toc
573+ # as raw text and not clickable entries.
574+ if test " $2 " == " html" ; then
575+ sed -i.bak ' s/^\\listoffigures$//g' " ${input} "
576+ sed -i.bak ' s/^\\listoftables$//g' " ${input} "
577+ fi
566578}
567579
568580# latexdiff is pretty great, but it has some incompatibilities with our template, so we
@@ -693,6 +705,22 @@ analyze_latex_logs() {
693705 fi
694706}
695707
708+ # Copy generated files (if any) back to the source directory so they can be cached and speed up future runs.
709+ cache_generated_files () {
710+ find . -type f \( \
711+ -name " *.aux" -o \
712+ -name " *.lof" -o \
713+ -name " *.lot" -o \
714+ -name " *.toc" -o \
715+ -name " *.upa" -o \
716+ -name " *.upb" -o \
717+ -name " *.convert.pdf" -o \
718+ -name " *.mermaid.pdf" -o \
719+ -name " *.mermaid.svg" -o \
720+ -name " *.aasvg.pdf" \
721+ \) -exec cp --parents {} " ${SOURCE_DIR} " \; 2> /dev/null
722+ }
723+
696724# Takes Markdown input and writes LaTeX output using pandoc.
697725do_latex () {
698726 local input=$1
@@ -777,18 +805,7 @@ do_pdf() {
777805 # Write any LaTeX errors to stderr.
778806 >&2 grep -A 5 " ] ! " " ${logfile} "
779807
780- # Copy generated files (if any) back to the source directory so they can be cached and speed up future runs.
781- find . -type f \( \
782- -name " *.aux" -o \
783- -name " *.lof" -o \
784- -name " *.lot" -o \
785- -name " *.toc" -o \
786- -name " *.upa" -o \
787- -name " *.upb" -o \
788- -name " *.convert.pdf" -o \
789- -name " *.mermaid.pdf" -o \
790- -name " *.aasvg.pdf" \
791- \) -exec cp --parents {} " ${SOURCE_DIR} " \; 2> /dev/null
808+ cache_generated_files
792809 echo " Elapsed time: $(( $end - $start )) seconds"
793810 # Write any LaTeX errors to stderr.
794811 >&2 grep -A 5 " ! " " ${logfile} "
@@ -846,6 +863,8 @@ do_docx() {
846863 else
847864 echo " DOCX output generated to file: ${output} "
848865 fi
866+
867+ cache_generated_files
849868}
850869
851870# Takes Markdown input and writes HTML output using pandoc.
@@ -884,6 +903,10 @@ do_html() {
884903 --metadata=logo:/resources/img/tcg.png
885904 --metadata=titlepage-rule-height:0
886905 --metadata=colorlinks:true
906+ --metadata=link-bibliography
907+ --metadata=link-citations
908+ --metadata=link-references
909+ --citeproc
887910 --metadata=contact:admin@trustedcomputinggroup.org
888911 --from=${FROM}
889912 ${EXTRA_PANDOC_OPTIONS}
@@ -895,6 +918,7 @@ do_html() {
895918 FAILED=true
896919 echo " HTML output failed"
897920 else
921+ cache_generated_files
898922 echo " HTML output generated to file: ${output} "
899923 fi
900924}
924948
925949# Generate the html output
926950if [ -n " ${HTML_OUTPUT} " ]; then
951+ do_md_fixups " ${BUILD_DIR} /${INPUT_FILE} " " html"
927952 do_html " ${BUILD_DIR} /${INPUT_FILE} " " ${SOURCE_DIR} /${HTML_OUTPUT} " " ${CROSSREF_TYPE} "
928953fi
929954
0 commit comments