Build system

- Split function definitions up into seperate script
- Source the `helpers.sh` script in the `makebook.sh` script
This commit is contained in:
Tristan B. Velloza Kildaire 2023-01-22 13:11:04 +02:00
parent 0903a2b712
commit 6e0df6da25
2 changed files with 30 additions and 28 deletions

29
helpers.sh Normal file
View File

@ -0,0 +1,29 @@
# Documentation generation helpers
# Generates LaTeX book and PDF
function generateBook()
{
# Run twice because latex
pandoc --top-level-division=part --number-sections --toc docs/00-bookindex.md docs/01-dedication.md docs/introduction/*.md docs/language/*.md docs/implementation/* -s -t latex --highlight-style kate
pandoc --top-level-division=part --number-sections --toc docs/00-bookindex.md docs/01-dedication.md docs/introduction/*.md docs/language/*.md docs/implementation/* -s -t latex --highlight-style kate | pdflatex > /dev/null
mv texput.pdf book.pdf
}
# Generates a single page AsciiDoc document and converts to HTML then
function doAsciiDoc()
{
pandoc --toc docs/00-bookindex.md docs/01-dedication.md docs/introduction/*.md docs/language/*.md docs/implementation/* -s -t asciidoc --highlight-style kate > book.ad
asciidoc -d book book.ad
mv book.html tlang.html
}
# Generate graphs
function generateGraphs()
{
graphs="$(ls docs/graphs/*.dot)"
for graph in $graphs
do
cat $graph | circo -Tpng -o$graph.png
cat $graph | circo -Tsvg -o$graph.svg
done
}

View File

@ -7,34 +7,7 @@ docs/internals/dependencies/*.md
docs/internals/codegen/*.md
"
# Generates LaTeX book and PDF
function generateBook()
{
# Run twice because latex
pandoc --top-level-division=part --number-sections --toc docs/00-bookindex.md docs/01-dedication.md docs/introduction/*.md docs/language/*.md docs/implementation/* -s -t latex --highlight-style kate
pandoc --top-level-division=part --number-sections --toc docs/00-bookindex.md docs/01-dedication.md docs/introduction/*.md docs/language/*.md docs/implementation/* -s -t latex --highlight-style kate | pdflatex > /dev/null
mv texput.pdf book.pdf
}
# Generates a single page AsciiDoc document and converts to HTML then
function doAsciiDoc()
{
pandoc --toc docs/00-bookindex.md docs/01-dedication.md docs/introduction/*.md docs/language/*.md docs/implementation/* -s -t asciidoc --highlight-style kate > book.ad
asciidoc -d book book.ad
mv book.html tlang.html
}
# Generate graphs
function generateGraphs()
{
graphs="$(ls docs/graphs/*.dot)"
for graph in $graphs
do
cat $graph | circo -Tpng -o$graph.png
cat $graph | circo -Tsvg -o$graph.svg
done
}
source helpers.sh
generateGraphs
generateBook