diff --git a/TODO b/TODO index 2f52aa4..98f539c 100644 --- a/TODO +++ b/TODO @@ -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 diff --git a/website/RenderTestCases.lhs b/website/RenderTestCases.lhs index 11a57cc..6b2fba6 100644 --- a/website/RenderTestCases.lhs +++ b/website/RenderTestCases.lhs @@ -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 "" -> 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 "" -> let sql' = "\n~~~~{.sql}\n" ++ sql ++ "\n~~~~\n" -> hask' = "\n~~~~{.haskell}\n" ++ hask ++ "\n~~~~\n" -> putStrLn $ "" +> 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 "
" ++ sql' -> ++ "" ++ hask' ++ "
" +> 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 diff --git a/website/index.asciidoc b/website/index.asciidoc index 717f7ce..8efdeed 100644 --- a/website/index.asciidoc +++ b/website/index.asciidoc @@ -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 diff --git a/website/make_website.sh b/website/make_website.sh index 5fb0ea2..95fa4dd 100755 --- a/website/make_website.sh +++ b/website/make_website.sh @@ -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 diff --git a/website/supported_sql.asciidoc b/website/supported_sql.asciidoc index b085140..7a1167c 100644 --- a/website/supported_sql.asciidoc +++ b/website/supported_sql.asciidoc @@ -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