1
Fork 0

overhaul website

This commit is contained in:
Jake Wheat 2024-01-26 16:29:58 +00:00
parent 45669ed7d3
commit 681cbfc416
19 changed files with 1008 additions and 1584 deletions

View file

@ -3,6 +3,7 @@
# there is no real reason to actually use the makefile except for a
# very small amount of convenience, apart from the website build
# and website consistency checks
.PHONY : build
build :
@ -19,6 +20,7 @@ test-coverage :
.PHONY : clean
clean :
cabal clean
cd website && cabal clean
rm -Rf build/
.PHONY : parserexe
@ -26,7 +28,7 @@ parserexe :
cabal build -fparserexe SimpleSQLParserTool
.PHONY : all
all : build test parserexe
all : build test parserexe website
###############################################
@ -39,39 +41,33 @@ all : build test parserexe
website : website-non-haddock build-haddock
.PHONY : website-non-haddock
website-non-haddock : build/main.css build/ocean.css build/index.html build/supported_sql.html \
build/test_cases.html build/contributing.html
website-non-haddock : build/main.css build/main1.css build/index.html \
build/supported_sql.html build/test_cases.html
build/main.css : website/main.css
mkdir -p build
cp website/main.css build
build/ocean.css : website/ocean.css
# todo: combine main and main1, change the one bit they can't share with sed
# to create the additional main1 as part of the build
build/main1.css : website/main1.css
mkdir -p build
cp website/ocean.css build
cp website/main1.css build
build/index.html : website/index.asciidoc website/AddLinks.hs
asciidoctor website/index.asciidoc -o - | cabal -v0 exec runhaskell website/AddLinks.hs > build/index.html
build/index.html : website/index.md website/template.pandoc
mkdir -p build
pandoc -s --template website/template.pandoc -V toc-title:"Table of contents" -c main.css -f markdown -t html --toc=true --metadata title="Simple SQL Parser" website/index.md > build/index.html
build/supported_sql.html : website/supported_sql.asciidoc website/AddLinks.hs
asciidoctor website/supported_sql.asciidoc -o - | cabal -v0 exec runhaskell website/AddLinks.hs > build/supported_sql.html
build/supported_sql.html : website/supported_sql.md website/template.pandoc
mkdir -p build
pandoc -s --template website/template.pandoc -V toc-title:"Table of contents" -c main.css -f markdown -t html --toc=true --metadata title="Simple SQL Parser supported SQL" website/supported_sql.md > build/supported_sql.html
build/contributing.html : website/contributing.asciidoc website/AddLinks.hs
asciidoctor website/contributing.asciidoc -o - | cabal -v0 exec runhaskell website/AddLinks.hs > build/contributing.html
build/test_cases.html : website/RenderTestCases.hs
cabal -v0 exec runhaskell -- --ghc-arg=-package=pretty-show -itools website/RenderTestCases.hs > build/test_cases.asciidoc
asciidoctor build/test_cases.asciidoc -o - | \
sed -e "s/max-width:62\.5em//g" > build/test_cases.html
# TODO: reduce the text size on the test cases page
# TODO: use scrollbars inside the tables
# TODO: make the tables autowidth
# -e "s/(code.*)font-size:1em/\1font-size:0.8em/g"
rm build/test_cases.asciidoc
# the tests don't render right if the TestCases aren't all at the same level
# of group nesting, which should be fixed - if this isn't the case, it
# will silently not render some of the tests
build/test_cases.html : website/RenderTestCases.hs website/template1.pandoc
mkdir -p build
# no idea why not using --disable-optimisation on cabal build, but putting -O0
# in the cabal file (and then cabal appears to say it's still using -O1
# is faster
cd website/ && cabal build RenderTestCases && cabal run RenderTestCases | pandoc -s -N --template template1.pandoc -V toc-title:"Simple SQL Parser test case examples" -c main1.css -f markdown -t html --toc=true --metadata title="Simple SQL Parse test case examples" > ../build/test_cases.html
# works here, but not in a recipe. amazing
# GHC_VER="$(shell ghc --numeric-version)"
@ -85,3 +81,13 @@ build-haddock :
$(eval GHC_VER="$(shell ghc --numeric-version)")
$(eval SSP_VER="$(shell cat simple-sql-parser.cabal |grep -P '^version:' | awk '{print $$2}')")
cp -R dist-newstyle/build/x86_64-linux/ghc-${GHC_VER}/simple-sql-parser-${SSP_VER}/doc/html/simple-sql-parser/* build/haddock/
# check the website pages code snippets
.PHONY : doctool
doctool :
cabal build -fparserexe SimpleSQLParserTool
silverbane website/index.md
.PHONY : really-all
really-all : build test parserexe website doctool