HTML writer: stringify alt text.
Previously, if you had formatting in the label of an Image
element, you'd get escaped HTML in the alt attribute. Now
you just get a plain string version, which seems preferable.
commit6c0e86d1444e401af2590287a86c1963043fee2e
authorJohn MacFarlane <jgm@berkeley.edu>
dateSat 5 Feb 2011, 08:16 (16 years ago)
parent798c5d5
src/Tests/Writers/HTML.hs+5
@@ -38,4 +38,9 @@ tests = [ testGroup "inline code"
3838 , "nolanguage" =: codeWith ("",["nolanguage"],[]) ">>="
3939 =?> "<code class=\"nolanguage\">>>=</code>"
4040 ]
41+ , testGroup "images"
42+ [ "alt with formatting" =:
43+ image "/url" "title" ("my " +++ emph "image")
44+ =?> "<img src=\"/url\" title=\"title\" alt=\"my image\" />"
45+ ]
4146 ]
src/Text/Pandoc/Writers/HTML.hs+1−2
@@ -602,8 +602,7 @@ inlineToHtml opts inline =
602602 if null tit then [] else [title tit]) $
603603 linkText
604604 (Image txt (s,tit)) -> do
605− alternate <- inlineListToHtml opts txt
606− let alternate' = showHtmlFragment alternate
605+ let alternate' = stringify txt
607606 let attributes = [src s] ++
608607 (if null tit
609608 then []