Merge pull request #2725 from skirridsystems/main

Create separate scripts for building HTML and PDF documents
This commit is contained in:
Daniel Marjamäki 2020-07-25 09:38:07 +02:00 committed by GitHub
commit 6a27580b61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 7 deletions

4
.gitignore vendored
View File

@ -103,10 +103,10 @@ snap/.snapcraft
# Manual folder
man/manual.log
man/manual.tex
man/*.pdf
man/*.html
# CLion
.idea
/.metadata/
cmake-*
man/manual.pdf
man/manual.html

3
man/build-html.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
echo Building $1.html
pandoc $1.md -o $1.html -s --number-sections --toc --css manual.css

32
man/build-pdf.sh Normal file
View File

@ -0,0 +1,32 @@
#!/bin/sh
# This uses installed fonts, which vary between systems
# Segoe UI and Consolas are standard in Windows 10, DejaVu is more common on Linux
echo Building $1.pdf
MainFont="Segoe UI"
MonoFont="Consolas"
is_font_installed() {
fontname=$1
fc-list | grep -i "$fontname" >/dev/null
}
if ! is_font_installed "$MainFont"; then
MainFont="DejaVu Sans"
fi
if ! is_font_installed "$MonoFont"; then
MonoFont="DejaVu Sans Mono"
fi
# echo Using $MainFont / $MonoFont
pandoc $1.md -o $1.pdf -s --number-sections --toc \
--pdf-engine=xelatex \
--listings \
-f markdown \
-V mainfont="$MainFont" \
-V monofont="$Consolas" \
-V geometry:a4paper \
-V geometry:margin=2.4cm \
-V subparagraph \
-H manual-style.tex

View File

@ -1,10 +1,10 @@
#!/bin/sh
# To install required tools in debian:
# sudo apt-get install pandoc texlive-latex-base texlive-fonts-recommended texlive-latex-extra
# For Windows you can use the MiKTeX installer https://miktex.org/download
pandoc manual.md -o manual.pdf -s --number-sections --toc -f markdown --pdf-engine=xelatex --listings -V mainfont="Segoe UI" -V monofont="Consolas" -V geometry:a4paper -V geometry:margin=2.4cm -H manual-style.tex
./build-pdf.sh manual
./build-html.sh manual
pandoc manual.md -o manual.html -s --number-sections --toc --css manual.css
pandoc reference-cfg-format.md -o reference-cfg-format.pdf -s --number-sections --toc
pandoc reference-cfg-format.md -o reference-cfg-format.html -s --number-sections --toc
./build-pdf.sh reference-cfg-format
./build-html.sh reference-cfg-format