@@ -29,16 +29,20 @@ SCRIPT=$(readlink -f "$0")
2929SCRIPTPATH=$( dirname " $SCRIPT " )
3030echo " Running Pandoc to generate the LaTeX file..."
3131pandoc " $1 " \
32- -f gfm \
32+ -f markdown \
3333 --toc \
34+ --toc-depth=3 \
3435 --listings \
3536 --include-in-header ${SCRIPTPATH} /chapter_break.tex \
3637 --include-in-header ${SCRIPTPATH} /inline_code.tex \
3738 --include-in-header ${SCRIPTPATH} /bullet_style.tex \
3839 --include-in-header ${SCRIPTPATH} /pdf_properties.tex \
3940 --include-in-header ${SCRIPTPATH} /listings-setup.tex \
41+ --include-in-header ${SCRIPTPATH} /toc-styling.tex \
42+ --include-in-header ${SCRIPTPATH} /title_page.tex \
43+ --include-in-header ${SCRIPTPATH} /toc_pagebreak.tex \
4044 --highlight-style ${SCRIPTPATH} /pygments.theme \
41- -V toc-title=' Table of contents ' \
45+ -V toc-title=' Sysmon Guide Contents ' \
4246 -V linkcolor:blue \
4347 -V geometry:a4paper \
4448 -V geometry:margin=2cm \
@@ -59,6 +63,24 @@ xelatex -interaction=nonstopmode ${fn}.tex > pdfgen.log 2>&1
5963echo " Generating PDF (second pass for TOC)..."
6064xelatex -interaction=nonstopmode ${fn} .tex >> pdfgen.log 2>&1
6165
66+ # Replace first page with custom cover if cover image exists
67+ COVER_IMAGE=" ${SCRIPTPATH} /../chapters/media/TS_SysmonCommunityGuide_Cover.png"
68+ if [ -f " $COVER_IMAGE " ]; then
69+ echo " Replacing first page with custom cover..."
70+ TEMP_PDF=" ${fn} _temp.pdf"
71+ mv " ${fn} .pdf" " $TEMP_PDF "
72+
73+ if python3 " ${SCRIPTPATH} /replace_cover.py" " $TEMP_PDF " " $COVER_IMAGE " " ${fn} .pdf" ; then
74+ echo " Cover page replaced successfully"
75+ rm " $TEMP_PDF "
76+ else
77+ echo " Warning: Failed to replace cover page, using original PDF"
78+ mv " $TEMP_PDF " " ${fn} .pdf"
79+ fi
80+ else
81+ echo " Warning: Cover image not found at $COVER_IMAGE , skipping cover replacement"
82+ fi
83+
6284echo " Cleaning temp files..."
6385rm /tmp/temp.tex " $fn " .{tex,toc,aux,log}
6486
0 commit comments