git.iko.soy/typeable/pandoc
on master help sign in
Parsing: Changed type of escaped to return Char
7b97151John MacFarlane
src/Text/Pandoc/Parsing.hs+2−5
@@ -325,11 +325,8 @@ failUnlessLHS = do
325
325
326-- | Parses backslash, then applies character parser.
326-- | Parses backslash, then applies character parser.
327escaped :: GenParser Char st Char -- ^ Parser for character to escape
327escaped :: GenParser Char st Char -- ^ Parser for character to escape
328− -> GenParser Char st Inline
328+ -> GenParser Char st Char
329−escaped parser = try $ do
329+escaped parser = try $ char '\\' >> parser
330− char '\\'
331− result <- parser
332− return (Str [result])
333
330
334-- | Parses an uppercase roman numeral and returns (UpperRoman, number).
331-- | Parses an uppercase roman numeral and returns (UpperRoman, number).
335upperRoman :: GenParser Char st (ListNumberStyle, Int)
332upperRoman :: GenParser Char st (ListNumberStyle, Int)
src/Text/Pandoc/Readers/LaTeX.hs+1−1
@@ -677,7 +677,7 @@ sect = try (string "\\S") >> return (Str [chr 167])
677escapedChar :: GenParser Char st Inline
677escapedChar :: GenParser Char st Inline
678escapedChar = do
678escapedChar = do
679 result <- escaped (oneOf specialChars)
679 result <- escaped (oneOf specialChars)
680− return $ if result == Str "\n" then Str " " else result
680+ return $ if result == '\n' then Str " " else Str [result]
681
681
682emptyGroup :: GenParser Char st Inline
682emptyGroup :: GenParser Char st Inline
683emptyGroup = try $ do
683emptyGroup = try $ do
src/Text/Pandoc/Readers/RST.hs+2−1
@@ -750,7 +750,8 @@ hyphens = do
750 return $ Str result
750 return $ Str result
751
751
752escapedChar :: GenParser Char st Inline
752escapedChar :: GenParser Char st Inline
753−escapedChar = escaped anyChar
753+escapedChar = do c <- escaped anyChar
754+ return $ Str [c]
754
755
755symbol :: GenParser Char ParserState Inline
756symbol :: GenParser Char ParserState Inline
756symbol = do
757symbol = do