git.iko.soy/typeable/pandoc
on master help sign in
Properly handle commented-out list items in markdown.

Example: - a <!-- - b --> - c Resolves Issue #142. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1615 788f1e2b-df1e-0410-8736-df70ead52e1b

commiteb2e560d861387414fe03056189f32e54e83851b authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSun 1 Nov 2009, 02:38 (17 years ago) parenta4a5d41
4 files changed+17−4
src/Text/Pandoc/Readers/HTML.hs+1 src/Text/Pandoc/Readers/Markdown.hs+3−3 tests/markdown-reader-more.native+5−1 tests/markdown-reader-more.txt+8
src/Text/Pandoc/Readers/HTML.hs+1
@@ -38,6 +38,7 @@ module Text.Pandoc.Readers.HTML (
3838 htmlEndTag,
3939 extractTagType,
4040 htmlBlockElement,
41+ htmlComment,
4142 unsanitaryURI
4243 ) where
4344
src/Text/Pandoc/Readers/Markdown.hs+3−3
@@ -42,7 +42,7 @@ import Text.Pandoc.Readers.LaTeX ( rawLaTeXInline, rawLaTeXEnvironment' )
4242import Text.Pandoc.Readers.HTML ( rawHtmlBlock, anyHtmlBlockTag,
4343 anyHtmlInlineTag, anyHtmlTag,
4444 anyHtmlEndTag, htmlEndTag, extractTagType,
45− htmlBlockElement, unsanitaryURI )
45+ htmlBlockElement, htmlComment, unsanitaryURI )
4646import Text.Pandoc.CharacterReferences ( decodeCharacterReferences )
4747import Text.ParserCombinators.Parsec
4848import Control.Monad (when, liftM)
@@ -504,8 +504,8 @@ listLine = try $ do
504504 notFollowedBy' (do indentSpaces
505505 many (spaceChar)
506506 listStart)
507− line <- manyTill anyChar newline
508− return $ line ++ "\n"
507+ chunks <- manyTill (htmlComment <|> count 1 anyChar) newline
508+ return $ concat chunks ++ "\n"
509509
510510-- parse raw text for one list item, excluding start marker and continuations
511511rawListItem :: GenParser Char ParserState [Char]
tests/markdown-reader-more.native+5−1
@@ -15,5 +15,9 @@ Pandoc (Meta [] [] "")
1515, Plain [HtmlInline "<a>",HtmlInline "</a>"]
1616, Header 3 [Str "my",Space,Str "header"]
1717, Header 2 [Str "$",Space,Str "in",Space,Str "math"]
18−, Para [Math InlineMath "\\$2 + \\$3"] ]
18+, Para [Math InlineMath "\\$2 + \\$3"]
19+, Header 2 [Str "Commented",Str "-",Str "out",Space,Str "list",Space,Str "item"]
20+, BulletList
21+ [ [ Plain [Str "one"]
22+ , RawHtml "<!--\n- two\n-->" ], [ Plain [Str "three"] ] ] ]
1923
tests/markdown-reader-more.txt+8
@@ -51,3 +51,11 @@
5151
5252$\$2 + \$3$
5353
54+## Commented-out list item
55+
56+- one
57+<!--
58+- two
59+-->
60+- three
61+