git.iko.soy/typeable/pandoc
on master help sign in
HTML writer: always output <dt> element, even if it is empty
e6ba0ccAlexander Krotov
src/Text/Pandoc/Writers/HTML.hs+1−3
@@ -830,9 +830,7 @@ blockToHtml opts (OrderedList (startnum, numstyle, _) lst) = do
830 return $ foldl (!) l attribs
830 return $ foldl (!) l attribs
831blockToHtml opts (DefinitionList lst) = do
831blockToHtml opts (DefinitionList lst) = do
832 contents <- mapM (\(term, defs) ->
832 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
836 defs' <- mapM (liftM (\x -> H.dd (x >> nl opts)) .
834 defs' <- mapM (liftM (\x -> H.dd (x >> nl opts)) .
837 blockListToHtml opts) defs
835 blockListToHtml opts) defs
838 return $ mconcat $ nl opts : term' : nl opts :
836 return $ mconcat $ nl opts : term' : nl opts :
test/Tests/Writers/HTML.hs+5
@@ -43,4 +43,9 @@ tests = [ testGroup "inline code"
43 image "/url" "title" ("my " <> emph "image")
43 image "/url" "title" ("my " <> emph "image")
44 =?> "<img src=\"/url\" title=\"title\" alt=\"my image\" />"
44 =?> "<img src=\"/url\" title=\"title\" alt=\"my image\" />"
45 ]
45 ]
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+ ]
46 ]
51 ]