From 7c35c0bc253c3ca15c29adf3309f08a42b99127c Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Tue, 15 Jul 2008 20:41:27 +0000 Subject: Fixed bug in Markdown parser: regular $s triggering math mode. For example: "shoes ($20) and socks ($5)." The fix consists in two new restrictions: + the $ that ends a math span may not be directly followed by a digit. + no blank lines may be included within a math span. Thanks to Joseph Reagle for noticing the bug. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1326 788f1e2b-df1e-0410-8736-df70ead52e1b --- Text/Pandoc/Readers/Markdown.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Text/Pandoc/Readers') diff --git a/Text/Pandoc/Readers/Markdown.hs b/Text/Pandoc/Readers/Markdown.hs index f702a6e33..db9e214b0 100644 --- a/Text/Pandoc/Readers/Markdown.hs +++ b/Text/Pandoc/Readers/Markdown.hs @@ -873,8 +873,9 @@ math = try $ do failIfStrict char '$' notFollowedBy space - words' <- sepBy1 mathWord (many1 space) + words' <- sepBy1 mathWord (many1 (spaceChar <|> (newline >>~ notFollowedBy' blankline))) char '$' + notFollowedBy digit return $ Math $ joinWithSep " " words' emph :: GenParser Char ParserState Inline -- cgit v1.2.3