From ecbe9f763cc835086873db20cfb0df39d1ea8f1c Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 5 Apr 2012 13:52:12 -0700 Subject: Textile reader: Implemented literal escapes with `==` and ``. Closes #473. --- src/Text/Pandoc/Readers/Textile.hs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Readers/Textile.hs b/src/Text/Pandoc/Readers/Textile.hs index f33436835..35c134b13 100644 --- a/src/Text/Pandoc/Readers/Textile.hs +++ b/src/Text/Pandoc/Readers/Textile.hs @@ -78,7 +78,7 @@ readTextile state s = -- | Special chars border strings parsing specialChars :: [Char] -specialChars = "\\[]<>*#_@~-+^&,.;:!?|\"'%()" +specialChars = "\\[]<>*#_@~-+^&,.;:!?|\"'%()=" -- | Generate a Pandoc ADT from a textile document parseTextile :: GenParser Char ParserState Pandoc @@ -370,6 +370,7 @@ inlineParsers = [ autoLink , whitespace , endline , code + , escapedInline , htmlSpan , rawHtmlInline , note @@ -486,6 +487,23 @@ image = try $ do char '!' return $ Image [Str alt] (src, alt) +escapedInline :: GenParser Char ParserState Inline +escapedInline = escapedEqs <|> escapedTag + +-- | literal text escaped between == ... == +escapedEqs :: GenParser Char ParserState Inline +escapedEqs = try $ do + string "==" + contents <- manyTill anyChar (try $ string "==") + return $ Str contents + +-- | literal text escaped btw tags +escapedTag :: GenParser Char ParserState Inline +escapedTag = try $ do + string "" + contents <- manyTill anyChar (try $ string "") + return $ Str contents + -- | Any special symbol defined in specialChars symbol :: GenParser Char ParserState Inline symbol = do -- cgit v1.2.3