]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/img.pm
Avoid %links accumulating duplicates. (For TOVA)
[ikiwiki.git] / IkiWiki / Plugin / img.pm
index 5c580c03cec01a5c4529fefd9f207702e0306d58..a697fea198d1ba7c2b386a704b3971ff30894a7a 100644 (file)
@@ -43,7 +43,7 @@ sub preprocess (@) {
                return '';
        }
 
-       push @{$links{$params{page}}}, $image;
+       add_link($params{page}, $image);
        # optimisation: detect scan mode, and avoid generating the image
        if (! defined wantarray) {
                return;
@@ -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}.'"' : '').