mirror of
https://github.com/jgm/pandoc.git
synced 2026-07-10 19:37:12 +00:00
HTML reader: ignore style tags in the body.
They are invalid but do occur in the wild. Closes #10643.
This commit is contained in:
@@ -242,7 +242,7 @@ block = ((do
|
||||
"main" -> pDiv
|
||||
"figure" -> pFigure
|
||||
"iframe" -> pIframe
|
||||
"style" -> pRawHtmlBlock
|
||||
"style" -> mempty <$ pHtmlBlock "style" -- see #10643
|
||||
"textarea" -> pRawHtmlBlock
|
||||
"switch"
|
||||
| epubExts
|
||||
@@ -537,7 +537,7 @@ pIframe = try $ do
|
||||
|
||||
pRawHtmlBlock :: PandocMonad m => TagParser m Blocks
|
||||
pRawHtmlBlock = do
|
||||
raw <- pHtmlBlock "script" <|> pHtmlBlock "style" <|> pHtmlBlock "textarea"
|
||||
raw <- pHtmlBlock "script" <|> pHtmlBlock "textarea"
|
||||
<|> pRawTag
|
||||
exts <- getOption readerExtensions
|
||||
if extensionEnabled Ext_raw_html exts && not (T.null raw)
|
||||
@@ -716,6 +716,7 @@ inline = pTagText <|> do
|
||||
"input"
|
||||
| lookup "type" attr == Just "checkbox"
|
||||
-> asks inListItem >>= guard >> pCheckbox
|
||||
"style" -> mempty <$ pHtmlBlock "style" -- see #10643
|
||||
"script"
|
||||
| Just x <- lookup "type" attr
|
||||
, "math/tex" `T.isPrefixOf` x -> pScriptMath
|
||||
@@ -1080,6 +1081,8 @@ isInlineTag :: Tag Text -> Bool
|
||||
isInlineTag t = isCommentTag t || case t of
|
||||
TagOpen "script" _ -> "math/tex" `T.isPrefixOf` fromAttrib "type" t
|
||||
TagClose "script" -> True
|
||||
TagOpen "style" _ -> True -- see #10643, invalid but it happens
|
||||
TagClose "style" -> True
|
||||
TagOpen name _ -> isInlineTagName name
|
||||
TagClose name -> isInlineTagName name
|
||||
_ -> False
|
||||
|
||||
Reference in New Issue
Block a user