- New scripts all require pre-processing pandoc firstly

This commit is contained in:
Tristan B. Velloza Kildaire 2023-04-18 17:39:10 +02:00
parent 4c7aa516a6
commit fdd0bd38be
4 changed files with 71 additions and 6 deletions

View File

@ -4,17 +4,57 @@
function generateBook()
{
# Run twice because latex
pandoc -f markdown --top-level-division=part --number-sections --toc docs/00-bookindex.md docs/01-dedication.md docs/introduction/*.md docs/language/*.md docs/implementation/* \
pandoc -F pandoc-plot -M plot-configuration=pandoc-plot-book.conf -f markdown --top-level-division=part --number-sections --toc docs_src/00-bookindex.md docs_src/01-dedication.md docs_src/introduction/*.md docs_src/language/*.md docs_src/implementation/* \
-s -t latex --highlight-style kate
pandoc -f markdown --top-level-division=part --number-sections --toc docs/00-bookindex.md docs/01-dedication.md docs/introduction/*.md docs/language/*.md docs/implementation/* \
pandoc -F pandoc-plot -f markdown --top-level-division=part --number-sections --toc docs_src/00-bookindex.md docs_src/01-dedication.md docs_src/introduction/*.md docs_src/language/*.md docs_src/implementation/* \
-s -t latex --highlight-style kate | pdflatex > /dev/null
mv texput.pdf book.pdf
}
# Generates updated markdown based on sources
function generateMarkdown()
{
# Site docs
#
# From GitHub flavored markdown, filtered through pandoc-plot, to GitHub flavored markdown
siteDocs="$(ls docs_src/*.md)"
for doc in $siteDocs
do
echo "Converting markdown for doc '$doc'..."
# pandoc -F pandoc-plot -M plot-configuration=pandoc-plot.conf -f gfm -t gfm "$doc" -o "docs/$(echo $doc | cut -b 9-)"
cp $doc "docs/$(echo $doc | cut -b 9-)"
echo "Converting markdown for doc '$doc'... [done]"
done
# Documentation docs
#
# From markdown, filtered through pandoc-plot, to markdown
docs="$(ls docs_src/introduction/*.md) $(ls docs_src/language/*.md $(ls docs_src/implementation/*.md))"
for doc in $docs
do
echo "Converting markdown for doc '$doc'..."
outputFile="docs/$(echo $doc | cut -b 9-)"
pandoc -F pandoc-plot -M plot-configuration=pandoc-plot.conf -f markdown -t markdown "$doc" -o "$outputFile"
echo "$(cat $outputFile | sed -e s/docs//)" > "$outputFile"
cat "$outputFile"
# break
echo "Converting markdown for doc '$doc'... [done]"
done
#pandoc -F pandoc-plot -f markdown --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 markdown --highlight-style kate -o /tmp/bruh.md
}
# 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
pandoc -F pandoc-plot -M plot-configuration=pandoc-plot-book.conf -f markdown --top-level-division=part --number-sections --toc docs_src/00-bookindex.md docs_src/01-dedication.md docs_src/introduction/*.md docs_src/language/*.md docs_src/implementation/* -s -t asciidoc --highlight-style kate > book.ad
asciidoc -d book book.ad
mv book.html tlang.html
}

13
makead.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
internalsPaths="
docs/internals/lexing/*.md
docs/internals/parsing/*.md
docs/internals/dependencies/*.md
docs/internals/codegen/*.md
"
source helpers.sh
# generateGraphs
doAsciiDoc

View File

@ -9,6 +9,5 @@ docs/internals/codegen/*.md
source helpers.sh
generateGraphs
generateBook
doAsciiDoc
# generateGraphs
generateBook

13
makemarkdown.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
internalsPaths="
docs/internals/lexing/*.md
docs/internals/parsing/*.md
docs/internals/dependencies/*.md
docs/internals/codegen/*.md
"
source helpers.sh
# generateGraphs
generateMarkdown