img: only provide alt text if it was specified
authorGabriel McManus <gmcmanus@gmail.com>
Mon, 7 Jul 2008 11:33:01 +0000 (21:33 +1000)
committerJoey Hess <joey@gnu.kitenet.net>
Thu, 22 Jan 2009 02:17:57 +0000 (21:17 -0500)
if suitable alternate text is unknown, then it should not be given.
empty alt text is suitable mainly for purely decorative images.
(cherry picked from commit 3cd7f67f0cf894f4fd5ba16f68e82e4f7bdbfdc5)

IkiWiki/Plugin/img.pm

index 5c580c03cec01a5c4529fefd9f207702e0306d58..d295b833b21b57ccfef5c5d985ae91281efb466b 100644 (file)
@@ -119,9 +119,9 @@ sub preprocess (@) {
        }
 
        my $imgtag='<img src="'.$imgurl.
-               '" alt="'.(exists $params{alt} ? $params{alt} : '').
                '" width="'.$im->Get("width").
                '" height="'.$im->Get("height").'"'.
+               (exists $params{alt} ? '" alt="'.$params{alt}.'"' : '').
                (exists $params{title} ? ' title="'.$params{title}.'"' : '').
                (exists $params{class} ? ' class="'.$params{class}.'"' : '').
                (exists $params{id} ? ' id="'.$params{id}.'"' : '').