@@ -15,8 +15,10 @@ PR_NUMBER=""
15
15
PR_REPO=" "
16
16
DIFFBASE=" "
17
17
PDF_ENGINE=xelatex
18
+ CROSSREF_TYPE=" iso"
18
19
DO_AUTO_BACKMATTER=" yes"
19
20
21
+
20
22
# Start up the dbus daemon (drawio will use it later)
21
23
dbus-daemon --system || echo " Failed to start dbus daemon"
22
24
@@ -40,6 +42,7 @@ print_usage() {
40
42
echo
41
43
echo " Output Control (note that output file names are always relative to the current directory)"
42
44
echo " --docx=output: enable output of docx and specify the output file name."
45
+ echo " --crossref=(iso|tcg): set cross-reference style."
43
46
echo " --pdf=output: enable output of pdf and specify the output file name."
44
47
echo " --latex=output: enable output of latex and specify the output file name."
45
48
echo " --html=output: enable output of html and specify the output file name."
@@ -64,7 +67,7 @@ print_usage() {
64
67
}
65
68
66
69
67
- 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:,docx:,html:,resourcedir:,noautobackmatter --options=" " -- " $@ " ) ; then
70
+ 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:,docx:,crossref:, html:,resourcedir:,noautobackmatter --options=" " -- " $@ " ) ; then
68
71
echo " Incorrect options provided"
69
72
print_usage
70
73
exit 1
@@ -106,6 +109,10 @@ while true; do
106
109
DOCX_OUTPUT=" ${2} "
107
110
shift 2
108
111
;;
112
+ --crossref)
113
+ CROSSREF_TYPE=" ${2} "
114
+ shift 2
115
+ ;;
109
116
--latex)
110
117
LATEX_OUTPUT=" ${2} "
111
118
shift 2
@@ -179,6 +186,7 @@ readonly PR_NUMBER
179
186
readonly PR_REPO
180
187
readonly DIFFBASE
181
188
readonly PDF_ENGINE
189
+ readonly CROSSREF_TYPE
182
190
183
191
shift " $(( OPTIND - 1 )) "
184
192
@@ -559,7 +567,7 @@ do_diff_tex_fixups() {
559
567
# The \multicolumn needs to be the first thing in the cell.
560
568
# Swap the order of any \DIF stuff and \multicolumn invocation inside a cell.
561
569
sed -i.bak ' s/\(\\DIF[^&]*\)\(\\multicolumn{[^{}]*}\({[^{}]*}\|{[^{}]*{[^{}]*}}\)\)/\2\1/g' " ${input} "
562
-
570
+
563
571
# latexdiff inserts its markers before \hline sometimes.
564
572
# After the transformations above, \hline needs to be the first thing in a line of text.
565
573
sed -i.bak ' s/\(\s*\)\(.*\)\(\\hline \|\\hlineifmdframed \)\(.*\)/\1\3\2\4/g' " ${input} "
@@ -648,7 +656,8 @@ analyze_latex_logs() {
648
656
do_latex () {
649
657
local input=$1
650
658
local output=$2
651
- local extra_pandoc_options=$3
659
+ local crossref=$3
660
+ local extra_pandoc_options=$4
652
661
mkdir -p " $( dirname ${output} ) "
653
662
654
663
# TODO: https://github.com/TrustedComputingGroup/pandoc/issues/164
@@ -684,7 +693,7 @@ do_latex() {
684
693
--metadata=link-citations
685
694
--metadata=link-bibliography
686
695
--metadata=titlepage-background:/resources/img/cover.png
687
- --metadata=crossrefYaml:/resources/filters/pandoc-crossref.yaml
696
+ --metadata=crossrefYaml:/resources/filters/pandoc-crossref- ${crossref} .yaml
688
697
--metadata=logo:/resources/img/tcg.png
689
698
--metadata=titlepage-rule-height:0
690
699
--metadata=colorlinks:true
@@ -798,6 +807,7 @@ do_docx() {
798
807
do_html () {
799
808
local input=$1
800
809
local output=$2
810
+ local crossref=$3
801
811
mkdir -p " $( dirname ${output} ) "
802
812
echo " Generating HTML Output"
803
813
local cmd=(pandoc
@@ -822,7 +832,7 @@ do_html() {
822
832
--variable=numbersections
823
833
--metadata=titlepage:true
824
834
--metadata=titlepage-background:/resources/img/cover.png
825
- --metadata=crossrefYaml:/resources/filters/pandoc-crossref.yaml
835
+ --metadata=crossrefYaml:/resources/filters/pandoc-crossref- ${crossref} .yaml
826
836
--metadata=logo:/resources/img/tcg.png
827
837
--metadata=titlepage-rule-height:0
828
838
--metadata=colorlinks:true
@@ -846,7 +856,7 @@ do_html() {
846
856
readonly TEMP_TEX_FILE=" ${BUILD_DIR} /${INPUT_FILE} .tex"
847
857
if [ -n " ${PDF_OUTPUT} " -o -n " ${LATEX_OUTPUT} " -o -n " ${DIFFPDF_OUTPUT} " -o -n " ${DIFFTEX_OUTPUT} " ]; then
848
858
do_md_fixups " ${BUILD_DIR} /${INPUT_FILE} "
849
- do_latex " ${BUILD_DIR} /${INPUT_FILE} " " ${TEMP_TEX_FILE} " " ${EXTRA_PANDOC_OPTIONS} "
859
+ do_latex " ${BUILD_DIR} /${INPUT_FILE} " " ${TEMP_TEX_FILE} " " ${CROSSREF_TYPE} " " ${ EXTRA_PANDOC_OPTIONS}"
850
860
fi
851
861
if [ -n " ${LATEX_OUTPUT} " ]; then
852
862
cp " ${TEMP_TEX_FILE} " " ${SOURCE_DIR} /${LATEX_OUTPUT} "
@@ -862,7 +872,7 @@ if [ -n "${PDF_OUTPUT}" ]; then
862
872
mkdir -p " $( dirname ${SOURCE_DIR} /${PDFLOG_OUTPUT} ) "
863
873
cp " ${LATEX_LOG} " " ${SOURCE_DIR} /${PDFLOG_OUTPUT} "
864
874
fi
865
- fi
875
+ fi
866
876
867
877
# Generate the docx output
868
878
if [ -n " ${DOCX_OUTPUT} " ]; then
@@ -885,7 +895,7 @@ if [ -n "${DIFFPDF_OUTPUT}" -o -n "${DIFFTEX_OUTPUT}" ]; then
885
895
echo " diff output failed"
886
896
else
887
897
do_md_fixups " ${BUILD_DIR} /${INPUT_FILE} "
888
- do_latex " ${BUILD_DIR} /${INPUT_FILE} " " ${TEMP_DIFFBASE_TEX_FILE} " " ${EXTRA_PANDOC_OPTIONS} -V keepstaleimages=true"
898
+ do_latex " ${BUILD_DIR} /${INPUT_FILE} " " ${TEMP_DIFFBASE_TEX_FILE} " " ${CROSSREF_TYPE} " " ${ EXTRA_PANDOC_OPTIONS} -V keepstaleimages=true"
889
899
echo " Running latexdiff... (this may take a while for complex changes)"
890
900
start=$( date +%s)
891
901
latexdiff-fast --math-markup=whole --preamble /resources/templates/latexdiff.tex --config /resources/templates/latexdiff.cfg --append-safecmd /resources/templates/latexdiff.safe --exclude-safecmd /resources/templates/latexdiff.unsafe " ${TEMP_DIFFBASE_TEX_FILE} " " ${TEMP_TEX_FILE} " > " ${TEMP_DIFF_TEX_FILE} " 2> " ${TEMP_LATEXDIFF_LOG} "
0 commit comments