diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-06-24 13:47:10 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-06-24 13:47:10 +0200 |
commit | 743419af5c0872d8e4b5fdf53d47080e8648b4a7 (patch) | |
tree | d304748dd51536424a564b866d2520d74ee2bb1a /trypandoc | |
parent | dd8f086a2c56b7ee98d7721c3dca7f9ae1f19948 (diff) | |
download | pandoc-743419af5c0872d8e4b5fdf53d47080e8648b4a7.tar.gz |
Readers.getReader, Writers.getWriter API change.
Now these functions return a pair of a reader/writer and an
Extensions, instead of building the extensions into the
reader/writer. The calling code must explicitly set
readerExtensions or writerExtensions using the Extensions
returned.
The point of the change is to make it possible for the
calling code to determine what extensions are being used.
See #3659.
Diffstat (limited to 'trypandoc')
-rw-r--r-- | trypandoc/trypandoc.hs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/trypandoc/trypandoc.hs b/trypandoc/trypandoc.hs index b8b821883..5a4828877 100644 --- a/trypandoc/trypandoc.hs +++ b/trypandoc/trypandoc.hs @@ -3,15 +3,15 @@ module Main where import Network.Wai.Handler.CGI import Network.Wai import Control.Applicative ((<$>)) -import Data.Maybe (mapMaybe, fromMaybe) +import Data.Maybe (fromMaybe) import Network.HTTP.Types.Status (status200) import Network.HTTP.Types.Header (hContentType) import Network.HTTP.Types.URI (queryToQueryText) import Text.Pandoc +import Text.Pandoc.Writers.Math (defaultMathJaxURL) import Text.Pandoc.Highlighting (pygments) import Text.Pandoc.Readers (getReader, Reader(..)) import Text.Pandoc.Writers (getWriter, Writer(..)) -import Text.Pandoc.Error (PandocError) import Text.Pandoc.Shared (tabFilter) import Data.Aeson import qualified Data.Text as T @@ -29,11 +29,13 @@ app req respond = do fromFormat <- fromMaybe "" <$> getParam "from" toFormat <- fromMaybe "" <$> getParam "to" let reader = case getReader (T.unpack fromFormat) of - Right (TextReader r) -> r readerOpts + Right (TextReader r, es) -> r readerOpts{ + readerExtensions = es } _ -> error $ "could not find reader for " ++ T.unpack fromFormat let writer = case getWriter (T.unpack toFormat) of - Right (TextWriter w) -> w writerOpts + Right (TextWriter w, es) -> w writerOpts{ + writerExtensions = es } _ -> error $ "could not find writer for " ++ T.unpack toFormat let result = case runPure $ reader (tabFilter 4 text) >>= writer of |