git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: Added a 'try' in rawLaTeXBlock.

This allows the markdown reader to treat '\begin' (not followed by an argument) as a raw string rather than erroring out when it doesn't find a '{'. Closes #622.

commit1038606036a800b8edfd54f96cb8841bf7998872 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 22 Sep 2012, 13:00 (14 years ago) parent93c35cb
2 files changed+5−1
src/Text/Pandoc/Readers/LaTeX.hs+1−1 tests/Tests/Readers/Markdown.hs+4
src/Text/Pandoc/Readers/LaTeX.hs+1−1
@@ -713,7 +713,7 @@ verbatimEnv = do
713713 return (r,rest)
714714
715715rawLaTeXBlock :: Parser [Char] ParserState String
716−rawLaTeXBlock = snd <$> withRaw (environment <|> blockCommand)
716+rawLaTeXBlock = snd <$> try (withRaw (environment <|> blockCommand))
717717
718718rawLaTeXInline :: Parser [Char] ParserState Inline
719719rawLaTeXInline = do
tests/Tests/Readers/Markdown.hs+4
@@ -44,6 +44,10 @@ tests = [ testGroup "inline code"
4444 "`*` {.haskell .special x=\"7\"}"
4545 =?> para (codeWith ("",["haskell","special"],[("x","7")]) "*")
4646 ]
47+ , testGroup "raw LaTeX"
48+ [ "in URL" =:
49+ "\\begin\n" =?> para (text "\\begin")
50+ ]
4751 , testGroup "backslash escapes"
4852 [ "in URL" =:
4953 "[hi](/there\\))"