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.
This commit is contained in:
John MacFarlane 2011-02-05 08:16:34 -08:00
parent 798c5d55bb
commit 6c0e86d144
2 changed files with 6 additions and 2 deletions

View file

@ -38,4 +38,9 @@ tests = [ testGroup "inline code"
, "nolanguage" =: codeWith ("",["nolanguage"],[]) ">>="
=?> "<code class=\"nolanguage\">&gt;&gt;=</code>"
]
, testGroup "images"
[ "alt with formatting" =:
image "/url" "title" ("my " +++ emph "image")
=?> "<img src=\"/url\" title=\"title\" alt=\"my image\" />"
]
]

View file

@ -602,8 +602,7 @@ inlineToHtml opts inline =
if null tit then [] else [title tit]) $
linkText
(Image txt (s,tit)) -> do
alternate <- inlineListToHtml opts txt
let alternate' = showHtmlFragment alternate
let alternate' = stringify txt
let attributes = [src s] ++
(if null tit
then []