From 63a23cabf48376ac953278b4f9a9dec538fd4c5a Mon Sep 17 00:00:00 2001 From: Jake Wheat Date: Sat, 15 Aug 2015 16:17:12 +0300 Subject: [PATCH] small infrastructure fixes updates to website text updates to website generation add a little makefile --- Makefile | 30 ++++++++++++++++++++++++++++++ simple-sql-parser.cabal | 4 ++-- website/AddLinks.lhs | 34 ++++++++++++++++++++++++++++++++++ website/index.asciidoc | 17 +++++++++++------ website/make_website.sh | 7 ++++--- website/supported_sql.asciidoc | 2 -- 6 files changed, 81 insertions(+), 13 deletions(-) create mode 100644 Makefile create mode 100644 website/AddLinks.lhs diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5f82a16 --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ + +# quick makefile to document how to do the various tasks + +# there is no real reason to actually use the makefile except for a +# very small amount of convenience + +.PHONY : init +init : + cabal sandbox init + cabal install --only-dependencies --enable-tests + cabal configure --enable-tests + +.PHONY : build +build : + cabal build + +.PHONY : test +test : build + dist/build/Tests/Tests --hide-successes + +.PHONY : website +website : + website/make_website.sh + +.PHONY : clean +clean : + cabal clean + cabal sandbox delete + rm -Rf build/ + diff --git a/simple-sql-parser.cabal b/simple-sql-parser.cabal index 5a5aef5..e7e2b00 100644 --- a/simple-sql-parser.cabal +++ b/simple-sql-parser.cabal @@ -7,9 +7,9 @@ description: A parser for SQL. Parses most SQL:2011 transaction management and session management syntax. Please see the homepage for more information - . + . -homepage: http://jakewheat.github.io/simple-sql-parser/ +homepage: http://jakewheat.github.io/simple-sql-parser/latest license: BSD3 license-file: LICENSE author: Jake Wheat diff --git a/website/AddLinks.lhs b/website/AddLinks.lhs new file mode 100644 index 0000000..2337494 --- /dev/null +++ b/website/AddLinks.lhs @@ -0,0 +1,34 @@ + +Little hack to add links to the navigation bars + +> main :: IO () +> main = interact addLinks + + +> addLinks :: String -> String +> addLinks [] = error "not found" +> addLinks ('<':'/':'u':'l':'>':'\n':'<':'/':'d':'i':'v':'>':xs) = +> "" ++ linkSection ++ "\n" ++ xs +> addLinks (x:xs) = x : addLinks xs + +> linkSection :: String +> linkSection = +> "
\n\ +> \\n\ +> \
\n\ +> \\n" diff --git a/website/index.asciidoc b/website/index.asciidoc index d1de4f3..ebba7e6 100644 --- a/website/index.asciidoc +++ b/website/index.asciidoc @@ -26,9 +26,9 @@ Tested with GHC 7.10.2, 7.8.4 and 7.6.3. == Links -* Local haddock: link:haddock/index.html[] -* Supported SQL:link:supported_sql.html[] -* Examples: link:test_cases.html[simple-sql-parser test cases] +* Haddock: link:haddock/index.html[] +* Supported SQL: link:supported_sql.html[] +* Test cases: link:test_cases.html[simple-sql-parser test cases] * Homepage: http://jakewheat.github.io/simple-sql-parser/latest * Hackage: http://hackage.haskell.org/package/simple-sql-parser * Repository: https://github.com/JakeWheat/simple-sql-parser @@ -38,6 +38,12 @@ Tested with GHC 7.10.2, 7.8.4 and 7.6.3. * Parent project: http://jakewheat.github.io/ * Contact: +++jakewheatmail@gmail.com+++ +The simple-sql-parser is a lot less simple than it used to be. If you +just need to parse much simpler SQL than this, or want to start with a +simpler parser and modify it slightly, you could also look at the +basic query parser in the intro_to_parsing project, the code is here: +link:https://github.com/JakeWheat/intro_to_parsing/blob/master/SimpleSQLQueryParser0.lhs[SimpleSQLQueryParser]. + == Feature support * query expressions @@ -65,9 +71,8 @@ Tested with GHC 7.10.2, 7.8.4 and 7.6.3. See the link:supported_sql.html[] page for details on the supported SQL. -Here is a document with all the link:test_cases.html[simple-sql-parser -test cases] rendered in a webpage so you can get an idea of what it -supports. +Here is all the link:test_cases.html[simple-sql-parser test cases] +rendered in a webpage so you can get an idea of what it supports. == Examples diff --git a/website/make_website.sh b/website/make_website.sh index 95fa4dd..cc1009c 100755 --- a/website/make_website.sh +++ b/website/make_website.sh @@ -1,6 +1,5 @@ #! /bin/sh -set -x set -e # todo: check this is run from the project root and not the website/ @@ -11,9 +10,11 @@ cp website/main.css build cp website/ocean.css build # index -asciidoctor website/index.asciidoc -o build/index.html +asciidoctor website/index.asciidoc -o - | runhaskell website/AddLinks.lhs > build/index.html #pandoc --from=markdown --to=html website/index.txt -o build/index.html -c main.css --title=simple-sql-parser --toc -asciidoctor website/supported_sql.asciidoc -o build/supported_sql.html +asciidoctor website/supported_sql.asciidoc -o - | runhaskell website/AddLinks.lhs > build/supported_sql.html + + #pandoc --from=markdown --to=html website/supported_sql.txt -o build/supported_sql.html -c main.css '--title=simple-sql-parser supported SQL' --toc diff --git a/website/supported_sql.asciidoc b/website/supported_sql.asciidoc index 7a1167c..2cdbb43 100644 --- a/website/supported_sql.asciidoc +++ b/website/supported_sql.asciidoc @@ -8,8 +8,6 @@ == Overview -link:index.html[simple-sql-parser home] - This page has more details on the supported SQL in simple-sql-parser. See the link:test_cases.html[simple-sql-parser test cases] page for