gdritter repos telml / 15251f4
Add standalone utility to convert telml to html Getty Ritter 6 years ago
2 changed file(s) with 27 addition(s) and 0 deletion(s). Collapse all Expand all
1111 cabal-version: >= 1.10
1212 build-type: Simple
1313 extra-source-files: README.md, ChangeLog.md
14
15 executable telml2html
16 default-language: Haskell2010
17 ghc-options: -Wall
18 hs-source-dirs: telml2html
19 main-is: Main.hs
20 build-depends: base
21 , telml
22 , telml-markup
23 , blaze-markup
1424
1525 library
1626 default-language: Haskell2010
1 module Main where
2
3 import Control.Monad ((>=>))
4 import qualified Data.TeLML as TeLML
5 import qualified Data.TeLML.Markup as TeLML
6 import qualified Text.Blaze.Renderer.String as B
7 import qualified System.Exit as Sys
8
9 doRender :: String -> Either String String
10 doRender = TeLML.parse >=> TeLML.render >=> return . B.renderMarkup
11
12 main :: IO ()
13 main = do
14 cs <- getContents
15 case doRender cs of
16 Left err -> Sys.die err
17 Right x -> putStrLn x