HTML reader: don't fail on unmatched closing "script" tag.
Prevent the reader from crashing if the HTML input contains an unmatched closing `</script>` tag. Fixes: #7282
This commit is contained in:
parent
3f09f53459
commit
875f8f3654
2 changed files with 16 additions and 7 deletions
|
@ -942,13 +942,15 @@ getTagName (TagClose t) = Just t
|
|||
getTagName _ = Nothing
|
||||
|
||||
isInlineTag :: Tag Text -> Bool
|
||||
isInlineTag t =
|
||||
isCommentTag t ||
|
||||
case getTagName t of
|
||||
Nothing -> False
|
||||
Just "script" -> "math/tex" `T.isPrefixOf` fromAttrib "type" t
|
||||
Just x -> x `Set.notMember` blockTags ||
|
||||
T.take 1 x == "?" -- processing instr.
|
||||
isInlineTag t = isCommentTag t || case t of
|
||||
TagOpen "script" _ -> "math/tex" `T.isPrefixOf` fromAttrib "type" t
|
||||
TagClose "script" -> True
|
||||
TagOpen name _ -> isInlineTagName name
|
||||
TagClose name -> isInlineTagName name
|
||||
_ -> False
|
||||
where isInlineTagName x =
|
||||
x `Set.notMember` blockTags ||
|
||||
T.take 1 x == "?" -- processing instr.
|
||||
|
||||
isBlockTag :: Tag Text -> Bool
|
||||
isBlockTag t = isBlockTagName || isTagComment t
|
||||
|
|
7
test/command/7282.md
Normal file
7
test/command/7282.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
Don't crash on unmatched closing tag.
|
||||
```
|
||||
% pandoc -f html -t native
|
||||
</script>
|
||||
^D
|
||||
[]
|
||||
```
|
Loading…
Add table
Reference in a new issue