mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-22 23:45:48 +00:00
Textile reader: Implemented literal escapes with == and <notextile>.
Closes #473.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user