aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2011-12-05 20:22:27 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2011-12-05 20:22:27 -0800
commit7b971517b031e2df2edee0a39d7dc6737bcf9a38 (patch)
tree6878577a4d8e37619c35969c6fc8b80da678852d
parentb2c58c11b20abc350c560bb4e7645194c6cb2801 (diff)
downloadpandoc-7b971517b031e2df2edee0a39d7dc6737bcf9a38.tar.gz
Parsing: Changed type of escaped to return Char
-rw-r--r--src/Text/Pandoc/Parsing.hs7
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs2
-rw-r--r--src/Text/Pandoc/Readers/RST.hs3
3 files changed, 5 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs
index eaf0c0f67..acfdda2c4 100644
--- a/src/Text/Pandoc/Parsing.hs
+++ b/src/Text/Pandoc/Parsing.hs
@@ -325,11 +325,8 @@ failUnlessLHS = do
-- | Parses backslash, then applies character parser.
escaped :: GenParser Char st Char -- ^ Parser for character to escape
- -> GenParser Char st Inline
-escaped parser = try $ do
- char '\\'
- result <- parser
- return (Str [result])
+ -> GenParser Char st Char
+escaped parser = try $ char '\\' >> parser
-- | Parses an uppercase roman numeral and returns (UpperRoman, number).
upperRoman :: GenParser Char st (ListNumberStyle, Int)
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index a6b7cc19a..9610b75a5 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -677,7 +677,7 @@ sect = try (string "\\S") >> return (Str [chr 167])
escapedChar :: GenParser Char st Inline
escapedChar = do
result <- escaped (oneOf specialChars)
- return $ if result == Str "\n" then Str " " else result
+ return $ if result == '\n' then Str " " else Str [result]
emptyGroup :: GenParser Char st Inline
emptyGroup = try $ do
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 49ddb90fc..3dcfe47d0 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -750,7 +750,8 @@ hyphens = do
return $ Str result
escapedChar :: GenParser Char st Inline
-escapedChar = escaped anyChar
+escapedChar = do c <- escaped anyChar
+ return $ Str [c]
symbol :: GenParser Char ParserState Inline
symbol = do