Markdown reader: internal changes.

Refactored escapedChar into escapedChar', escapedChar.
This commit is contained in:
John MacFarlane 2011-12-05 20:27:10 -08:00
parent 7b971517b0
commit c39cdc15ba

View file

@ -939,13 +939,17 @@ failIfLink :: Inline -> GenParser tok st Inline
failIfLink (Link _ _) = pzero
failIfLink elt = return elt
escapedChar :: GenParser Char ParserState Inline
escapedChar = try $ do
escapedChar' :: GenParser Char ParserState Char
escapedChar' = try $ do
char '\\'
state <- getState
result <- if stateStrict state
if stateStrict state
then oneOf "\\`*_{}[]()>#+-.!~"
else satisfy (not . isAlphaNum)
escapedChar :: GenParser Char ParserState Inline
escapedChar = do
result <- escapedChar'
return $ case result of
' ' -> Str "\160" -- "\ " is a nonbreaking space
'\n' -> LineBreak -- "\[newline]" is a linebreak