aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-04-05 13:52:12 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-04-05 13:52:12 -0700
commitecbe9f763cc835086873db20cfb0df39d1ea8f1c (patch)
treec905f8c5755ee8caa6306ab5135db706ddc2fc8e
parent55833fd4a79084e27964871c2f515ff38870fb18 (diff)
downloadpandoc-ecbe9f763cc835086873db20cfb0df39d1ea8f1c.tar.gz
Textile reader: Implemented literal escapes with `==` and `<notextile>`.
Closes #473.
-rw-r--r--src/Text/Pandoc/Readers/Textile.hs20
1 files changed, 19 insertions, 1 deletions
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 <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