Markdown reader: internal changes.
Refactored escapedChar into escapedChar', escapedChar.
This commit is contained in:
parent
7b971517b0
commit
c39cdc15ba
1 changed files with 9 additions and 5 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue