git.iko.soy/typeable/pandoc
on master help sign in
Textile reader: fix for `<notextile>` and `==`.

Closes #517.

commit75cba828b5c69299c3a4a1e33df8deae3a6c291e authorpaul.rivier <paul.r.ml@gmail.com> dateTue 29 May 2012, 13:41 (14 years ago) parent9a47237
3 files changed+18−10
src/Text/Pandoc/Readers/Textile.hs+3−10 tests/textile-reader.native+4 tests/textile-reader.textile+11
src/Text/Pandoc/Readers/Textile.hs+3−10
@@ -493,19 +493,12 @@ escapedInline :: GenParser Char ParserState Inline
493493escapedInline = escapedEqs <|> escapedTag
494494
495495escapedEqs :: GenParser Char ParserState Inline
496−escapedEqs = Str <$> (try $ surrounded (string "==") anyChar)
497−
498−-- -- | literal text escaped between == ... ==
499−-- escapedEqs :: GenParser Char ParserState Inline
500−-- escapedEqs = try $ do
501−-- string "=="
502−-- contents <- manyTill anyChar (try $ string "==")
503−-- return $ Str contents
496+escapedEqs = Str <$> (try $ string "==" *> manyTill anyChar (try $ string "=="))
504497
505498-- | literal text escaped btw <notextile> tags
506499escapedTag :: GenParser Char ParserState Inline
507−escapedTag = try $ Str <$>
508− enclosed (string "<notextile>") (try $ string "</notextile>") anyChar
500+escapedTag = Str <$>
501+ (try $ string "<notextile>" *> manyTill anyChar (try $ string "</notextile>"))
509502
510503-- | Any special symbol defined in wordBoundaries
511504symbol :: GenParser Char ParserState Inline
tests/textile-reader.native+4
@@ -27,6 +27,10 @@ Pandoc (Meta {docTitle = [], docAuthors = [], docDate = []})
2727,CodeBlock ("",[],[]) " this code block is indented by two tabs\n\n These should not be escaped: \\$ \\\\ \\> \\[ \\{"
2828,CodeBlock ("",[],[]) "Code block with .bc\n continued\n @</\\\n"
2929,Para [Str "Inline",Space,Str "code",Str ":",Space,Code ("",[],[]) "<tt>",Str ",",Space,Code ("",[],[]) "@",Str "."]
30+,Header 1 [Str "Notextile"]
31+,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 ":"]
32+,Para [Str "\nNo *bold* and\n* no bullet\n"]
33+,Para [Str "and",Space,Str "inlines",Space,Str "can",Space,Str "be",Space,Str "protected",Space,Str "with",Space,Str "double *equals (=)* markup",Str "."]
3034,Header 1 [Str "Lists"]
3135,Header 2 [Str "Unordered"]
3236,Para [Str "Asterisks",Space,Str "tight",Str ":"]
tests/textile-reader.textile+11
@@ -70,6 +70,17 @@ bc. Code block with .bc
7070
7171Inline code: @<tt>@, <tt>@</tt>.
7272
73+h1. Notextile
74+
75+A block of text can be protected with notextile :
76+
77+<notextile>
78+No *bold* and
79+* no bullet
80+</notextile>
81+
82+and inlines can be protected with ==double *equals (=)* markup==.
83+
7384h1. Lists
7485
7586h2. Unordered