aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2011-01-01 22:46:30 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2011-01-01 22:46:30 -0800
commit3e61333af0f5ac1cdb045bdab0293f03e2e1e39e (patch)
treef57121abaa05824e11e22381411566231279a864 /src/Text/Pandoc/Readers
parent0411f514338e5d27dc80847758cc28fc824a88c5 (diff)
downloadpandoc-3e61333af0f5ac1cdb045bdab0293f03e2e1e39e.tar.gz
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.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs6
1 files changed, 3 insertions, 3 deletions
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)