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 /src/Text/Pandoc/Lua | |
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 'src/Text/Pandoc/Lua')
-rw-r--r-- | src/Text/Pandoc/Lua/PandocModule.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Lua/PandocModule.hs b/src/Text/Pandoc/Lua/PandocModule.hs index 27c19d4f0..fccfbebf3 100644 --- a/src/Text/Pandoc/Lua/PandocModule.hs +++ b/src/Text/Pandoc/Lua/PandocModule.hs @@ -34,6 +34,7 @@ import Data.Text (pack) import Scripting.Lua (LuaState, call, push, pushhsfunction, rawset) import Text.Pandoc.Class hiding (readDataFile) import Text.Pandoc.Definition (Pandoc) +import Text.Pandoc.Options (ReaderOptions(readerExtensions)) import Text.Pandoc.Lua.Compat (loadstring) import Text.Pandoc.Lua.StackInstances () import Text.Pandoc.Readers (Reader (..), getReader) @@ -57,10 +58,10 @@ read_doc :: String -> String -> IO (Either String Pandoc) read_doc formatSpec content = do case getReader formatSpec of Left s -> return $ Left s - Right reader -> + Right (reader, es) -> case reader of TextReader r -> do - res <- runIO $ r def (pack content) + res <- runIO $ r def{ readerExtensions = es } (pack content) case res of Left s -> return . Left $ show s Right pd -> return $ Right pd |