aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs16
-rw-r--r--test/command/7282.md7
2 files changed, 16 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index f5c8a2277..0a9d67e35 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -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
diff --git a/test/command/7282.md b/test/command/7282.md
new file mode 100644
index 000000000..4ed6b5b3e
--- /dev/null
+++ b/test/command/7282.md
@@ -0,0 +1,7 @@
+Don't crash on unmatched closing tag.
+```
+% pandoc -f html -t native
+</script>
+^D
+[]
+```