git.iko.soy/typeable/pandoc
on master help sign in
HTML writer: always output <dt> element, even if it is empty

Fixes #4883

commite6ba0cc8936a0520bee96de6c2eb42973caa4058 authorAlexander Krotov <ilabdsf@gmail.com> dateTue 11 Sep 2018, 13:12 (8 years ago) parent97f6833
2 files changed+6−3
src/Text/Pandoc/Writers/HTML.hs+1−3 test/Tests/Writers/HTML.hs+5
src/Text/Pandoc/Writers/HTML.hs+1−3
@@ -830,9 +830,7 @@ blockToHtml opts (OrderedList (startnum, numstyle, _) lst) = do
830830 return $ foldl (!) l attribs
831831blockToHtml opts (DefinitionList lst) = do
832832 contents <- mapM (\(term, defs) ->
833− do term' <- if null term
834− then return mempty
835− else liftM H.dt $ inlineListToHtml opts term
833+ do term' <- liftM H.dt $ inlineListToHtml opts term
836834 defs' <- mapM (liftM (\x -> H.dd (x >> nl opts)) .
837835 blockListToHtml opts) defs
838836 return $ mconcat $ nl opts : term' : nl opts :
test/Tests/Writers/HTML.hs+5
@@ -43,4 +43,9 @@ tests = [ testGroup "inline code"
4343 image "/url" "title" ("my " <> emph "image")
4444 =?> "<img src=\"/url\" title=\"title\" alt=\"my image\" />"
4545 ]
46+ , testGroup "blocks"
47+ [ "definition list with empty <dt>" =:
48+ definitionList [(mempty, [para $ text "foo bar"])]
49+ =?> "<dl><dt></dt><dd><p>foo bar</p></dd></dl>"
50+ ]
4651 ]