summaryrefslogtreecommitdiff
path: root/trypandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-05-27 21:18:17 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-05-27 21:18:17 -0700
commit17b4066d677b24c490e60900958b25183a56ff62 (patch)
treee735d9f5e320e5739c1e9425716e85ff84eb2318 /trypandoc
parent05d238cd397c2a2720089a643192c1f1c7bad0df (diff)
trypandoc - fixes for new API.
Diffstat (limited to 'trypandoc')
-rw-r--r--trypandoc/trypandoc.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/trypandoc/trypandoc.hs b/trypandoc/trypandoc.hs
index c530f45f2..210bab49f 100644
--- a/trypandoc/trypandoc.hs
+++ b/trypandoc/trypandoc.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE OverloadedStrings, CPP #-}
module Main where
import Network.Wai.Handler.CGI
import Network.Wai
@@ -29,7 +29,13 @@ app req respond = do
$ lookup fromFormat fromFormats
let writer = maybe (error $ "could not find writer for " ++ T.unpack toFormat) id
$ 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
+#endif
let output = encode $ object [ T.pack "result" .= result
, T.pack "name" .=
if fromFormat == "markdown_strict"