git.iko.soy/typeable/pandoc
on master help sign in
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

commitd989a78b3bc701beb7dbe186297d2f3fc8cd6721 authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateMon 31 Dec 2007, 00:05 (19 years ago) parent6e1a652
1 file changed+9−2
Text/Pandoc/Readers/HTML.hs+9−2
Text/Pandoc/Readers/HTML.hs+9−2
@@ -196,7 +196,14 @@ htmlScript = try $ do
196196 rest <- manyTill anyChar (htmlEndTag "script")
197197 return $ open ++ rest ++ "</script>"
198198
199−htmlBlockElement = choice [ htmlScript, htmlComment, xmlDec, definition ]
199+-- | Parses material between style tags.
200+-- Style tags must be treated differently, because they can contain CSS
201+htmlStyle = try $ do
202+ open <- string "<style"
203+ rest <- manyTill anyChar (htmlEndTag "style")
204+ return $ open ++ rest ++ "</style>"
205+
206+htmlBlockElement = choice [ htmlScript, htmlStyle, htmlComment, xmlDec, definition ]
200207
201208rawHtmlBlock = try $ do
202209 body <- htmlBlockElement <|> anyHtmlTag <|> anyHtmlEndTag
@@ -435,7 +442,7 @@ code = try $ do
435442 joinWithSep " " $ lines result
436443
437444rawHtmlInline = do
438− result <- htmlScript <|> htmlComment <|> anyHtmlInlineTag
445+ result <- htmlScript <|> htmlStyle <|> htmlComment <|> anyHtmlInlineTag
439446 state <- getState
440447 if stateParseRaw state then return (HtmlInline result) else return (Str "")
441448