diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2015-02-18 13:03:45 +0000 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2015-02-18 21:09:06 +0000 |
commit | b8acb9f541a460504ad4356beed82cbaf3374a27 (patch) | |
tree | fac14561bbf2c3c5a6372a5635c02a81eec748a8 /src/Text/Pandoc | |
parent | 9f6a92d664aa89eac4641e80cf2b9b10b6360e7f (diff) | |
download | pandoc-b8acb9f541a460504ad4356beed82cbaf3374a27.tar.gz |
Change return type of LaTeX reader
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX.hs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 942b9f3b3..633388db8 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -57,11 +57,12 @@ import qualified Data.Map as M import qualified Control.Exception as E import System.FilePath (takeExtension, addExtension) import Text.Pandoc.Highlighting (fromListingsLanguage) +import Text.Pandoc.Error -- | Parse LaTeX from string and return 'Pandoc' document. readLaTeX :: ReaderOptions -- ^ Reader options -> String -- ^ String to parse (assumes @'\n'@ line endings) - -> Pandoc + -> Either PandocError Pandoc readLaTeX opts = readWith parseLaTeX def{ stateOptions = opts } parseLaTeX :: LP Pandoc @@ -851,12 +852,8 @@ rawEnv name = do type IncludeParser = ParserT [Char] [String] IO String -- | Replace "include" commands with file contents. -handleIncludes :: String -> IO String -handleIncludes s = do - res <- runParserT includeParser' [] "input" s - case res of - Right s' -> return s' - Left e -> error $ show e +handleIncludes :: String -> IO (Either PandocError String) +handleIncludes s = mapLeft (ParsecError s) <$> runParserT includeParser' [] "input" s includeParser' :: IncludeParser includeParser' = |