diff --git a/helpers.sh b/helpers.sh index ce37b05..b22c603 100644 --- a/helpers.sh +++ b/helpers.sh @@ -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 } diff --git a/makead.sh b/makead.sh new file mode 100755 index 0000000..94cc2db --- /dev/null +++ b/makead.sh @@ -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 \ No newline at end of file diff --git a/makebook.sh b/makebook.sh index 34b8555..9008d95 100755 --- a/makebook.sh +++ b/makebook.sh @@ -9,6 +9,5 @@ docs/internals/codegen/*.md source helpers.sh -generateGraphs -generateBook -doAsciiDoc \ No newline at end of file +# generateGraphs +generateBook \ No newline at end of file diff --git a/makemarkdown.sh b/makemarkdown.sh new file mode 100755 index 0000000..77b88fd --- /dev/null +++ b/makemarkdown.sh @@ -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 \ No newline at end of file