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 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
|
||||
then oneOf "\\`*_{}[]()>#+-.!~"
|
||||
else satisfy (not . isAlphaNum)
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue