git.iko.soy/typeable/pandoc
on master help sign in
Small fix to error handling in TeXMath parser:
af2ea86fiddlosopher
Text/Pandoc/Readers/TeXMath.hs+3−3
@@ -38,8 +38,8 @@ import Text.Pandoc.Shared
38
38
39-- | Converts a string of raw TeX math to a list of 'Pandoc' inlines.
39-- | Converts a string of raw TeX math to a list of 'Pandoc' inlines.
40readTeXMath :: String -> [Inline]
40readTeXMath :: String -> [Inline]
41−readTeXMath inp = case parse teXMath "input" inp of
41+readTeXMath inp = case parse teXMath ("formula: " ++ inp) inp of
42− Left err -> error $ "\nError:\n" ++ show err
42+ Left err -> [Str inp] -- if unparseable, just include original
43 Right res -> res
43 Right res -> res
44
44
45teXMath = manyTill mathPart eof >>= return . concat
45teXMath = manyTill mathPart eof >>= return . concat
@@ -73,7 +73,7 @@ letters = do
73 return [Emph [Str res]]
73 return [Emph [Str res]]
74
74
75misc = do
75misc = do
76− res <- noneOf "{}\\"
76+ res <- noneOf "}"
77 return [Str [res]]
77 return [Str [res]]
78
78
79scriptArg = try $ do
79scriptArg = try $ do