1
Fork 0

finish on the website updates for now

This commit is contained in:
Jake Wheat 2015-08-08 22:30:17 +03:00
parent b7d9d92ae7
commit 322b6f200d
5 changed files with 38 additions and 21 deletions

1
TODO
View file

@ -1,4 +1,3 @@
What will make this library nice and complete:
List of all the SQL that it doesn't support
annotation, with positions coming from the parser

View file

@ -1,5 +1,5 @@
Converts the test data to markdown
Converts the test data to asciidoc
> import Language.SQL.SimpleSQL.Tests
> import Text.Show.Pretty
@ -46,17 +46,32 @@ TODO: should put the dialect in the html output
> render = go False
> where
> go t (Heading level title : is) = do
> when t $ putStrLn "</table>"
> putStrLn $ replicate level '#' ++ " " ++ title
> when t $ putStrLn "|==="
> -- slight hack
> when (level > 1) $
> putStrLn $ "\n" ++ replicate level '=' ++ " " ++ title
> go False is
> go t (Row sql hask : is) = do
> unless t $ putStrLn "<table>"
> let sql' = "\n~~~~{.sql}\n" ++ sql ++ "\n~~~~\n"
> hask' = "\n~~~~{.haskell}\n" ++ hask ++ "\n~~~~\n"
> putStrLn $ "<tr><td>" ++ sql'
> ++ "</td><td>" ++ hask' ++ "</td></tr>"
> unless t $ putStrLn "[cols=\"2\"]\n|==="
> let sql' = "\n[source,sql]\n----\n" ++ sql ++ "\n----\n"
> hask' = "\n[source,haskell]\n----\n" ++ hask ++ "\n----\n"
> putStrLn $ "a| " ++ escapePipe sql'
> ++ "a| " ++ escapePipe hask' ++ " "
> go True is
> go t [] = when t $ putStrLn "</table>"
> go t [] = when t $ putStrLn "|==="
> escapePipe [] = []
> escapePipe ('\\':'|':xs) = '\\' : '\\' : '\\' : '|' : escapePipe xs
> escapePipe ('|':xs) = '\\' : '|' : escapePipe xs
> escapePipe (x:xs) = x : escapePipe xs
> main :: IO ()
> main = render $ doc 1 testData
> main = do
> putStrLn "\n:toc:\n\
> \:toc-placement: macro\n\
> \:sectnums:\n\
> \:toclevels: 10\n\
> \:sectnumlevels: 10\n\
> \:source-highlighter: pygments\n\n\
> \= simple-sql-parser examples/test cases\n\n\
> \toc::[]\n"
> render $ doc 1 testData

View file

@ -252,7 +252,7 @@ fetch first 100 rows only;
* Session management
** TODO
See the link:supported_sql.html page for details on
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

View file

@ -21,9 +21,18 @@ asciidoctor website/supported_sql.asciidoc -o build/supported_sql.html
# tpch sql file
# pandoc src/tpch.sql -s --highlight-style kate -o tpch.sql.html
# rendered test cases
runhaskell -package-db=.cabal-sandbox/x86_64-linux-ghc-7.10.2-packages.conf.d -i:tools website/RenderTestCases.lhs > build/test_cases.txt
pandoc --from=markdown --to=html build/test_cases.txt -o build/test_cases.html -c main.css '--title=simple-sql-parser examples/test cases' --toc
rm build/test_cases.txt
runhaskell -package-db=.cabal-sandbox/x86_64-linux-ghc-7.10.2-packages.conf.d -i:tools website/RenderTestCases.lhs > build/test_cases.asciidoc
#pandoc --from=markdown --to=html build/test_cases.asciidoc -o build/test_cases.html -c main.css '--title=simple-sql-parser examples/test cases' --toc
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
# haddock
cabal haddock
rm -Rf build/haddock

View file

@ -26,12 +26,6 @@ prohibit everything that the standard doesn't allow.
Apart from this permissiveness, some work has been put into trying to
get the best parser error messages possible.
Although the parser and syntax support some character set constructs,
any source is always parsed in the default system encoding which
Haskell uses, and any encoding/decoding is left to the system. I think
this effectively means that you will usually be using utf-8 character
set for the sql source.
== Queries
=== Select lists