aboutsummaryrefslogtreecommitdiff
path: root/Text/Pandoc
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-12-31 00:05:03 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-12-31 00:05:03 +0000
commitd989a78b3bc701beb7dbe186297d2f3fc8cd6721 (patch)
tree1abfe138375ea3f39c5e62270499c7c3dd031d3d /Text/Pandoc
parent6e1a65242954f788ac9c43566cb5d6432b47e350 (diff)
downloadpandoc-d989a78b3bc701beb7dbe186297d2f3fc8cd6721.tar.gz
HTML reader: Don't interpret contents of style tags as markdown.
Resolves Issue #40. + Added htmlStyle, analagous to htmlScript. + Use htmlStyle in htmlBlockElement and rawHtmlInline. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1162 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'Text/Pandoc')
-rw-r--r--Text/Pandoc/Readers/HTML.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/Text/Pandoc/Readers/HTML.hs b/Text/Pandoc/Readers/HTML.hs
index c3d597f00..9e5a0763a 100644
--- a/Text/Pandoc/Readers/HTML.hs
+++ b/Text/Pandoc/Readers/HTML.hs
@@ -196,7 +196,14 @@ htmlScript = try $ do
rest <- manyTill anyChar (htmlEndTag "script")
return $ open ++ rest ++ "</script>"
-htmlBlockElement = choice [ htmlScript, htmlComment, xmlDec, definition ]
+-- | Parses material between style tags.
+-- Style tags must be treated differently, because they can contain CSS
+htmlStyle = try $ do
+ open <- string "<style"
+ rest <- manyTill anyChar (htmlEndTag "style")
+ return $ open ++ rest ++ "</style>"
+
+htmlBlockElement = choice [ htmlScript, htmlStyle, htmlComment, xmlDec, definition ]
rawHtmlBlock = try $ do
body <- htmlBlockElement <|> anyHtmlTag <|> anyHtmlEndTag
@@ -435,7 +442,7 @@ code = try $ do
joinWithSep " " $ lines result
rawHtmlInline = do
- result <- htmlScript <|> htmlComment <|> anyHtmlInlineTag
+ result <- htmlScript <|> htmlStyle <|> htmlComment <|> anyHtmlInlineTag
state <- getState
if stateParseRaw state then return (HtmlInline result) else return (Str "")