@@ -6,6 +6,7 @@ do_gitversion="no"
6
6
do_gitstatus=" no"
7
7
pdf_output=" "
8
8
docx_output=" "
9
+ html_output=" "
9
10
latex_output=" "
10
11
table_rules=" no"
11
12
@@ -31,6 +32,7 @@ print_usage() {
31
32
echo " --docx=output: enable outputing of docx and specify the output file name."
32
33
echo " --pdf=output: enable outputing of pdf and specify the output file name."
33
34
echo " --latex=output: enable outputing of latex and specify the output file name."
35
+ echo " --html=output: enable outputing of html and specify the output file name."
34
36
echo
35
37
echo " Miscellaneous"
36
38
echo " --resourcedir=dir: Set the resource directory, defaults to root for pandoc containers"
@@ -41,7 +43,7 @@ print_usage() {
41
43
}
42
44
43
45
44
- if ! options=$( getopt --longoptions=help,puppeteer,notmp,gitversion,gitstatus,table_rules,pdf:,latex:,docx:,resourcedir: --options=" " -- " $@ " ) ; then
46
+ if ! options=$( getopt --longoptions=help,puppeteer,notmp,gitversion,gitstatus,table_rules,pdf:,latex:,docx:,html:, resourcedir: --options=" " -- " $@ " ) ; then
45
47
echo " Incorrect options provided"
46
48
print_usage
47
49
exit 1
@@ -79,6 +81,10 @@ while true; do
79
81
pdf_output=" ${2} "
80
82
shift 2
81
83
;;
84
+ --html)
85
+ html_output=" ${2} "
86
+ shift 2
87
+ ;;
82
88
--resourcedir)
83
89
resource_dir=" ${2} "
84
90
shift 2
@@ -115,8 +121,8 @@ if [ ! -e "${input_file}" ]; then
115
121
exit 1
116
122
fi
117
123
118
- if [ -z " ${pdf_output}${latex_output}${docx_output} " ]; then
119
- >&2 echo " Expected --pdf, --docx or --latex option"
124
+ if [ -z " ${pdf_output}${latex_output}${docx_output}${html_output} " ]; then
125
+ >&2 echo " Expected --pdf, --docx, --html, or --latex option"
120
126
print_usage
121
127
exit 1
122
128
fi
@@ -198,6 +204,7 @@ echo "file: ${input_file}"
198
204
echo " docx: ${docx_output:- none} "
199
205
echo " pdf: ${pdf_output:- none} "
200
206
echo " latex: ${latex_ouput:- none} "
207
+ echo " html: ${html_ouput:- none} "
201
208
echo " use tmp: ${is_tmp} "
202
209
echo " resource dir: ${resource_dir} "
203
210
echo " build dir: ${build_dir} "
@@ -291,8 +298,6 @@ if [ -n "${pdf_output}" ]; then
291
298
--metadata=crossrefYaml:/resources/filters/pandoc-crossref.yaml \
292
299
--metadata=logo:/resources/img/tcg.png \
293
300
--metadata=titlepage-rule-height:0 \
294
- --metadata=tables-vrules:true \
295
- --metadata=tables-hrules:true \
296
301
--metadata=colorlinks:true \
297
302
--metadata=contact:
[email protected] \
298
303
--from=markdown+implicit_figures+grid_tables+table_captions-markdown_in_html_blocks \
@@ -315,7 +320,7 @@ if [ -n "${latex_output}" ]; then
315
320
--standalone \
316
321
--template=eisvogel.latex \
317
322
--filter=mermaid-filter \
318
- --lua-filter=center-images \
323
+ --lua-filter=center-images.lua \
319
324
--lua-filter=parse-html.lua \
320
325
--filter=pandoc-crossref \
321
326
--lua-filter=divide-code-blocks.lua \
@@ -331,8 +336,6 @@ if [ -n "${latex_output}" ]; then
331
336
--metadata=crossrefYaml:/resources/filters/pandoc-crossref.yaml \
332
337
--metadata=logo:/resources/img/tcg.png \
333
338
--metadata=titlepage-rule-height:0 \
334
- --metadata=tables-vrules:true \
335
- --metadata=tables-hrules:true \
336
339
--metadata=colorlinks:true \
337
340
--metadata=contact:
[email protected] \
338
341
--from=markdown+implicit_figures+grid_tables+table_captions-markdown_in_html_blocks \
@@ -372,6 +375,49 @@ if [ -n "${docx_output}" ]; then
372
375
fi
373
376
fi
374
377
378
+ export MERMAID_FILTER_FORMAT=" svg"
379
+
380
+ # Generate the html output
381
+ if [ -n " ${html_output} " ]; then
382
+ echo " Generating html Output"
383
+ pandoc \
384
+ --toc \
385
+ -V colorlinks=true \
386
+ -V linkcolor=blue \
387
+ -V urlcolor=blue \
388
+ -V toccolor=blue \
389
+ --embed-resources \
390
+ --standalone \
391
+ --filter=mermaid-filter \
392
+ --lua-filter=center-images.lua \
393
+ --lua-filter=parse-html.lua \
394
+ --filter=pandoc-crossref \
395
+ --lua-filter=divide-code-blocks.lua \
396
+ --resource-path=.:/resources \
397
+ --data-dir=/resources \
398
+ --top-level-division=section \
399
+ --variable=block-headings \
400
+ --variable=numbersections \
401
+ --metadata=date-english:" ${DATE_ENGLISH} " \
402
+ --metadata=year:" ${YEAR} " \
403
+ --metadata=titlepage:true \
404
+ --metadata=titlepage-background:/resources/img/cover.png \
405
+ --metadata=crossrefYaml:/resources/filters/pandoc-crossref.yaml \
406
+ --metadata=logo:/resources/img/tcg.png \
407
+ --metadata=titlepage-rule-height:0 \
408
+ --metadata=colorlinks:true \
409
+ --metadata=contact:
[email protected] \
410
+ --from=markdown+implicit_figures+grid_tables+table_captions-markdown_in_html_blocks \
411
+ ${extra_pandoc_options} \
412
+ --to=html \
413
+ " ${build_dir} /${input_file} .3" \
414
+ --output=" ${html_output} "
415
+ echo " HTML Output Generated to file: ${html_output} "
416
+ if [ $? -ne 0 ]; then
417
+ RESULT=$?
418
+ fi
419
+ fi
420
+
375
421
if [ ${RESULT} -ne 0 ]; then
376
422
exit 1
377
423
fi
0 commit comments