Textile reader: fix for <notextile> and ==.

Closes #517.
This commit is contained in:
paul.rivier 2012-05-29 13:41:28 +02:00 committed by John MacFarlane
parent 9a47237412
commit 75cba828b5
3 changed files with 18 additions and 10 deletions

View file

@ -493,19 +493,12 @@ escapedInline :: GenParser Char ParserState Inline
escapedInline = escapedEqs <|> escapedTag
escapedEqs :: GenParser Char ParserState Inline
escapedEqs = Str <$> (try $ surrounded (string "==") anyChar)
-- -- | literal text escaped between == ... ==
-- escapedEqs :: GenParser Char ParserState Inline
-- escapedEqs = try $ do
-- string "=="
-- contents <- manyTill anyChar (try $ string "==")
-- return $ Str contents
escapedEqs = Str <$> (try $ string "==" *> manyTill anyChar (try $ string "=="))
-- | literal text escaped btw <notextile> tags
escapedTag :: GenParser Char ParserState Inline
escapedTag = try $ Str <$>
enclosed (string "<notextile>") (try $ string "</notextile>") anyChar
escapedTag = Str <$>
(try $ string "<notextile>" *> manyTill anyChar (try $ string "</notextile>"))
-- | Any special symbol defined in wordBoundaries
symbol :: GenParser Char ParserState Inline

View file

@ -27,6 +27,10 @@ Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []})
,CodeBlock ("",[],[]) " this code block is indented by two tabs\n\n These should not be escaped: \\$ \\\\ \\> \\[ \\{"
,CodeBlock ("",[],[]) "Code block with .bc\n continued\n @</\\\n"
,Para [Str "Inline",Space,Str "code",Str ":",Space,Code ("",[],[]) "<tt>",Str ",",Space,Code ("",[],[]) "@",Str "."]
,Header 1 [Str "Notextile"]
,Para [Str "A",Space,Str "block",Space,Str "of",Space,Str "text",Space,Str "can",Space,Str "be",Space,Str "protected",Space,Str "with",Space,Str "notextile",Space,Str ":"]
,Para [Str "\nNo *bold* and\n* no bullet\n"]
,Para [Str "and",Space,Str "inlines",Space,Str "can",Space,Str "be",Space,Str "protected",Space,Str "with",Space,Str "double *equals (=)* markup",Str "."]
,Header 1 [Str "Lists"]
,Header 2 [Str "Unordered"]
,Para [Str "Asterisks",Space,Str "tight",Str ":"]

View file

@ -70,6 +70,17 @@ bc. Code block with .bc
Inline code: @<tt>@, <tt>@</tt>.
h1. Notextile
A block of text can be protected with notextile :
<notextile>
No *bold* and
* no bullet
</notextile>
and inlines can be protected with ==double *equals (=)* markup==.
h1. Lists
h2. Unordered