aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-07-11 15:52:38 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-07-11 15:52:38 +0200
commit41209ea6765e9898d7e15c4c945c06275b6c0420 (patch)
tree7415aa9ad52d0db7ad831c0de88facbf19b8102b
parente6cdaea27fd588d43f037bf14868e1b9b147835c (diff)
downloadpandoc-41209ea6765e9898d7e15c4c945c06275b6c0420.tar.gz
HTML reader: Ensure that paragraphs are closed properly...
when the parent block element closes, even without `</p>`. Closes #3794.
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs2
-rw-r--r--test/command/3794.md7
2 files changed, 9 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index b07b65019..734973e33 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -805,6 +805,8 @@ pCloses tagtype = try $ do
(TagClose "dl") | tagtype == "dd" -> return ()
(TagClose "table") | tagtype == "td" -> return ()
(TagClose "table") | tagtype == "tr" -> return ()
+ (TagClose t') | tagtype == "p" && t' `Set.member` blockHtmlTags
+ -> return () -- see #3794
_ -> mzero
pTagText :: PandocMonad m => TagParser m Inlines
diff --git a/test/command/3794.md b/test/command/3794.md
new file mode 100644
index 000000000..b56e7b504
--- /dev/null
+++ b/test/command/3794.md
@@ -0,0 +1,7 @@
+```
+% pandoc -f html -t native
+<div><p>hello</div>
+^D
+[Div ("",[],[])
+ [Para [Str "hello"]]]
+```