git.iko.soy/typeable/pandoc
on master help sign in
Changed parsing of code blocks in HTML reader:

+ <code> tag is no longer needed. <pre> suffices. + all HTML tags in the code block (e.g. for syntax highlighting) are skipped, because they are not portable to other output formats. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1022 788f1e2b-df1e-0410-8736-df70ead52e1b

commit6f16d52c1185fea757047374100a9f10be7af3fc authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateMon 17 Sep 2007, 02:49 (19 years ago) parent2094534
1 file changed+8−7
src/Text/Pandoc/Readers/HTML.hs+8−7
src/Text/Pandoc/Readers/HTML.hs+8−7
@@ -100,7 +100,7 @@ extractTagType ('<':rest) =
100100 map toLower $ takeWhile isAlphaNum $ dropWhile isSpaceOrSlash rest
101101extractTagType _ = ""
102102
103−-- | Parse any HTML tag (closing or opening) and return text of tag
103+-- | Parse any HTML tag (opening or self-closing) and return text of tag
104104anyHtmlTag = try $ do
105105 char '<'
106106 spaces
@@ -313,15 +313,16 @@ hrule = try $ do
313313-- code blocks
314314--
315315
316+-- Note: HTML tags in code blocks (e.g. for syntax highlighting) are
317+-- skipped, because they are not portable to output formats other than HTML.
316318codeBlock = try $ do
317319 htmlTag "pre"
318− spaces
319− htmlTag "code"
320− result <- manyTill anyChar (htmlEndTag "code")
321− spaces
322− htmlEndTag "pre"
320+ result <- manyTill
321+ (many1 (satisfy (/= '<')) <|>
322+ ((anyHtmlTag <|> anyHtmlEndTag) >> return ""))
323+ (htmlEndTag "pre")
323324 return $ CodeBlock $ stripTrailingNewlines $
324− decodeCharacterReferences result
325+ decodeCharacterReferences $ concat result
325326
326327--
327328-- block quotes