git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #1912 from zudov/missing_alt
5073758Matthew Pickering
src/Text/Pandoc/Writers/HTML.hs+3−10
@@ -785,22 +785,15 @@ inlineToHtml opts inline =
785 then link'
785 then link'
786 else link' ! A.title (toValue tit)
786 else link' ! A.title (toValue tit)
787 (Image txt (s,tit)) | treatAsImage s -> do
787 (Image txt (s,tit)) | treatAsImage s -> do
788− let alternate' = stringify txt
789 let attributes = [A.src $ toValue s] ++
788 let attributes = [A.src $ toValue s] ++
790− (if null tit
791− then []
792− else [A.title $ toValue tit]) ++
789+ [A.title $ toValue tit | not $ null tit] ++
793− if null txt
794− then []
795− else [A.alt $ toValue alternate']
790+ [A.alt $ toValue $ stringify txt]
796 let tag = if writerHtml5 opts then H5.img else H.img
791 let tag = if writerHtml5 opts then H5.img else H.img
797 return $ foldl (!) tag attributes
792 return $ foldl (!) tag attributes
798 -- note: null title included, as in Markdown.pl
793 -- note: null title included, as in Markdown.pl
799 (Image _ (s,tit)) -> do
794 (Image _ (s,tit)) -> do
800 let attributes = [A.src $ toValue s] ++
795 let attributes = [A.src $ toValue s] ++
801− (if null tit
802− then []
803− else [A.title $ toValue tit])
796+ [A.title $ toValue tit | not $ null tit]
804 return $ foldl (!) H5.embed attributes
797 return $ foldl (!) H5.embed attributes
805 -- note: null title included, as in Markdown.pl
798 -- note: null title included, as in Markdown.pl
806 (Note contents)
799 (Note contents)