aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-12-23 03:46:12 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-12-23 03:46:12 +0000
commit6802d287cf8a5ad5423521520b5d16287e991536 (patch)
treef3145fa456c1a6d133e0826ff0b4ac52985ccc55
parentfbecb49790311480ff5e830052bf17c732ff8eab (diff)
downloadpandoc-6802d287cf8a5ad5423521520b5d16287e991536.tar.gz
Modified rawHtmlBlock in HTML reader so it parses </html> and </body> tags.
This allows these tags to be handled correctly in Markdown. HTML reader now uses rawHtmlBlock', which excludes </html> and </body>, since these are handled in parseHtml. (Resolves Issue #38.) git-svn-id: https://pandoc.googlecode.com/svn/trunk@1152 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r--Text/Pandoc/Readers/HTML.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/Text/Pandoc/Readers/HTML.hs b/Text/Pandoc/Readers/HTML.hs
index 70a071152..d379b373c 100644
--- a/Text/Pandoc/Readers/HTML.hs
+++ b/Text/Pandoc/Readers/HTML.hs
@@ -199,12 +199,16 @@ htmlScript = try $ do
htmlBlockElement = choice [ htmlScript, htmlComment, xmlDec, definition ]
rawHtmlBlock = try $ do
- notFollowedBy' (htmlTag "/body" <|> htmlTag "/html")
body <- htmlBlockElement <|> anyHtmlTag <|> anyHtmlEndTag
sp <- many space
state <- getState
if stateParseRaw state then return (RawHtml (body ++ sp)) else return Null
+-- We don't want to parse </body> or </html> as raw HTML, since these
+-- are handled in parseHtml.
+rawHtmlBlock' = do notFollowedBy' (htmlTag "/body" <|> htmlTag "/html")
+ rawHtmlBlock
+
-- | Parses an HTML comment.
htmlComment = try $ do
string "<!--"
@@ -284,7 +288,8 @@ block = choice [ codeBlock
, blockQuote
, para
, plain
- , rawHtmlBlock ] <?> "block"
+ , rawHtmlBlock'
+ ] <?> "block"
--
-- header blocks