From c39cdc15baaded62b5af066d99dd779120f7b298 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 5 Dec 2011 20:27:10 -0800 Subject: Markdown reader: internal changes. Refactored escapedChar into escapedChar', escapedChar. --- src/Text/Pandoc/Readers/Markdown.hs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index ab146bdd0..cdd75650c 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -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 -- cgit v1.2.3