Markdown writer: don't replace empty alt in image with "image".

Previously `<img src="empty.png" alt=""/>` would be translated as
`![image](empty.png)`; now it becomes `![](empty.png)` as one might
naturally expect.
This commit is contained in:
John MacFarlane 2012-04-03 18:28:08 -07:00
parent 30a99ecb7c
commit 0afd33e4c5

View file

@ -516,9 +516,9 @@ inlineToMarkdown opts (Link txt (src, tit)) = do
else "[" <> linktext <> "](" <>
text src <> linktitle <> ")"
inlineToMarkdown opts (Image alternate (source, tit)) = do
let txt = if (null alternate) || (alternate == [Str ""]) ||
(alternate == [Str source]) -- to prevent autolinks
then [Str "image"]
let txt = if null alternate || alternate == [Str source]
-- to prevent autolinks
then [Str ""]
else alternate
linkPart <- inlineToMarkdown opts (Link txt (source, tit))
return $ "!" <> linkPart