git.iko.soy/typeable/pandoc
on master help sign in
Textile reader: Implemented literal escapes with `==` and `<notextile>`.

Closes #473.

commitecbe9f763cc835086873db20cfb0df39d1ea8f1c authorJohn MacFarlane <fiddlosopher@gmail.com> dateThu 5 Apr 2012, 13:52 (15 years ago) parent55833fd
1 file changed+19−1
src/Text/Pandoc/Readers/Textile.hs+19−1
src/Text/Pandoc/Readers/Textile.hs+19−1
@@ -78,7 +78,7 @@ readTextile state s =
7878
7979-- | Special chars border strings parsing
8080specialChars :: [Char]
81−specialChars = "\\[]<>*#_@~-+^&,.;:!?|\"'%()"
81+specialChars = "\\[]<>*#_@~-+^&,.;:!?|\"'%()="
8282
8383-- | Generate a Pandoc ADT from a textile document
8484parseTextile :: GenParser Char ParserState Pandoc
@@ -370,6 +370,7 @@ inlineParsers = [ autoLink
370370 , whitespace
371371 , endline
372372 , code
373+ , escapedInline
373374 , htmlSpan
374375 , rawHtmlInline
375376 , note
@@ -486,6 +487,23 @@ image = try $ do
486487 char '!'
487488 return $ Image [Str alt] (src, alt)
488489
490+escapedInline :: GenParser Char ParserState Inline
491+escapedInline = escapedEqs <|> escapedTag
492+
493+-- | literal text escaped between == ... ==
494+escapedEqs :: GenParser Char ParserState Inline
495+escapedEqs = try $ do
496+ string "=="
497+ contents <- manyTill anyChar (try $ string "==")
498+ return $ Str contents
499+
500+-- | literal text escaped btw <notextile> tags
501+escapedTag :: GenParser Char ParserState Inline
502+escapedTag = try $ do
503+ string "<notextile>"
504+ contents <- manyTill anyChar (try $ string "</notextile>")
505+ return $ Str contents
506+
489507-- | Any special symbol defined in specialChars
490508symbol :: GenParser Char ParserState Inline
491509symbol = do