diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-04-11 10:10:54 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-04-11 10:10:54 -0700 |
commit | 8699071ec2d01dbf2c72eb6cda7794de8b850999 (patch) | |
tree | e59231079b96cd65a62f811fcfebbcccd6df5850 /src/Text/Pandoc/Readers | |
parent | 2304e9cb940e382afd5bce6722e9c52f482ce2f6 (diff) | |
download | pandoc-8699071ec2d01dbf2c72eb6cda7794de8b850999.tar.gz |
HTML reader: Treat processing instructions & declarations as block.
Previously these were treated as inline, and included in paragraph
tags in HTML or DocBook output, which is generally not what is wanted.
Closes #1233.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/HTML.hs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index 2101b2fc2..c94ee3d6b 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -610,15 +610,19 @@ blockTags :: [String] blockTags = blockHtmlTags ++ blockDocBookTags isInlineTag :: Tag String -> Bool -isInlineTag t = tagOpen (`notElem` blockTags) (const True) t || - tagClose (`notElem` blockTags) t || +isInlineTag t = tagOpen isInlineTagName (const True) t || + tagClose isInlineTagName t || tagComment (const True) t + where isInlineTagName x = x `notElem` blockTags isBlockTag :: Tag String -> Bool -isBlockTag t = tagOpen (`elem` blocktags) (const True) t || - tagClose (`elem` blocktags) t || +isBlockTag t = tagOpen isBlockTagName (const True) t || + tagClose isBlockTagName t || tagComment (const True) t - where blocktags = blockTags ++ eitherBlockOrInline + where isBlockTagName ('?':_) = True + isBlockTagName ('!':_) = True + isBlockTagName x = x `elem` blockTags + || x `elem` eitherBlockOrInline isTextTag :: Tag String -> Bool isTextTag = tagText (const True) |