Textile reader: Implemented literal escapes with == and <notextile>.

Closes #473.
This commit is contained in:
John MacFarlane
2012-04-05 13:52:12 -07:00
parent 55833fd4a7
commit ecbe9f763c
+19 -1
View File
@@ -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 <notextile> tags
escapedTag :: GenParser Char ParserState Inline
escapedTag = try $ do
string "<notextile>"
contents <- manyTill anyChar (try $ string "</notextile>")
return $ Str contents
-- | Any special symbol defined in specialChars
symbol :: GenParser Char ParserState Inline
symbol = do