@@ -379,13 +379,17 @@ blockToHtml _ Null = return mempty
379379blockToHtml opts (Plain lst) = inlineListToHtml opts lst
380380blockToHtml opts (Para [Image txt (s,tit)]) = do
381381 img <- inlineToHtml opts (Image txt (s,tit))
382− capt <- inlineListToHtml opts txt
382+ let tocapt = if writerHtml5 opts
383+ then H5.figcaption
384+ else H.p ! A.class_ "caption"
385+ capt <- if null txt
386+ then return mempty
387+ else tocapt `fmap` inlineListToHtml opts txt
383388 return $ if writerHtml5 opts
384389 then H5.figure $ mconcat
385− [nl opts, img, H5.figcaption capt, nl opts]
390+ [nl opts, img, capt, nl opts]
386391 else H.div ! A.class_ "figure" $ mconcat
387− [nl opts, img, H.p ! A.class_ "caption" $ capt,
388− nl opts]
392+ [nl opts, img, capt, nl opts]
389393blockToHtml opts (Para lst) = do
390394 contents <- inlineListToHtml opts lst
391395 return $ H.p contents