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