aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2011-12-05 20:27:10 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2011-12-05 20:27:10 -0800
commitc39cdc15baaded62b5af066d99dd779120f7b298 (patch)
tree464c651450376884b9eb90c22ff891cae1e6ae7a /src
parent7b971517b031e2df2edee0a39d7dc6737bcf9a38 (diff)
downloadpandoc-c39cdc15baaded62b5af066d99dd779120f7b298.tar.gz
Markdown reader: internal changes.
Refactored escapedChar into escapedChar', escapedChar.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs14
1 files changed, 9 insertions, 5 deletions
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