From 3e61333af0f5ac1cdb045bdab0293f03e2e1e39e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 1 Jan 2011 22:46:30 -0800 Subject: Fixed regression in markdown reader. '(_hi_)' was being parsed with literal underscores (no emphasis). The fix: the 'str' parser now only parses alphanumerics and embedded underscores. All other symbols are handled by the 'symbol' parser. This has a slight effect on the AST, since you'll get [Str "hi",Str ":"] insntead of [Str "hi:"]. But there should not be a visible effect in any of the writers. Thanks to gwern for pointing out the regression. --- src/Text/Pandoc/Readers/Markdown.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 6ba19d7a1..feeb1a69c 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -970,7 +970,7 @@ exampleRef = try $ do symbol :: GenParser Char ParserState Inline symbol = do - result <- oneOf specialCharsMinusLt + result <- noneOf "<\n\t " return $ Str [result] -- parses inline code, between n `s and n `s @@ -1057,8 +1057,8 @@ strChar = noneOf (specialChars ++ " \t\n") str :: GenParser Char ParserState Inline str = do - a <- strChar - as <- many (strChar <|> (try $ char '_' >>~ lookAhead alphaNum)) + a <- alphaNum + as <- many $ alphaNum <|> (try $ char '_' >>~ lookAhead alphaNum) let result = a:as state <- getState let spacesToNbr = map (\c -> if c == ' ' then '\160' else c) -- cgit v1.2.3