trypandoc - fixes for new API.
This commit is contained in:
parent
05d238cd39
commit
17b4066d67
1 changed files with 7 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings, CPP #-}
|
||||||
module Main where
|
module Main where
|
||||||
import Network.Wai.Handler.CGI
|
import Network.Wai.Handler.CGI
|
||||||
import Network.Wai
|
import Network.Wai
|
||||||
|
@ -29,7 +29,13 @@ app req respond = do
|
||||||
$ lookup fromFormat fromFormats
|
$ lookup fromFormat fromFormats
|
||||||
let writer = maybe (error $ "could not find writer for " ++ T.unpack toFormat) id
|
let writer = maybe (error $ "could not find writer for " ++ T.unpack toFormat) id
|
||||||
$ lookup toFormat toFormats
|
$ lookup toFormat toFormats
|
||||||
|
#if MIN_VERSION_pandoc(1,14,0)
|
||||||
|
let result = case reader $ tabFilter 4 $ T.unpack text of
|
||||||
|
Right doc -> T.pack $ writer doc
|
||||||
|
Left err -> error (show err)
|
||||||
|
#else
|
||||||
let result = T.pack $ writer $ reader $ tabFilter 4 $ T.unpack text
|
let result = T.pack $ writer $ reader $ tabFilter 4 $ T.unpack text
|
||||||
|
#endif
|
||||||
let output = encode $ object [ T.pack "result" .= result
|
let output = encode $ object [ T.pack "result" .= result
|
||||||
, T.pack "name" .=
|
, T.pack "name" .=
|
||||||
if fromFormat == "markdown_strict"
|
if fromFormat == "markdown_strict"
|
||||||
|
|
Loading…
Reference in a new issue