commit 81e7ecc81b174cc0bbb53455a6ae423c1ef8bede
parent 97ee01cf78c4c0f561c2a20520e401c498c046a6
Author: ukai <ukai>
Date: Thu, 5 Dec 2002 16:08:34 +0000
[w3m-dev 03528] area without alt
* map.c (getCurrentMapLabel): when a->alt is empty
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat:
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,5 +1,10 @@
2002-12-06 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+ * [w3m-dev 03528] area without alt
+ * map.c (getCurrentMapLabel): when a->alt is empty
+
+2002-12-06 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
* [w3m-dev 03527] fix frame.c
* frame.c (createFrameFile): move need_reconstruct
diff --git a/map.c b/map.c
@@ -137,7 +137,7 @@ getCurrentMapLabel(Buffer *buf)
ListItem *al;
MapArea *a;
int i, n;
- Str s;
+ Str s = NULL;
a_img = retrieveCurrentImg(buf);
if (!(a_img && a_img->image && a_img->image->map))
@@ -159,11 +159,15 @@ getCurrentMapLabel(Buffer *buf)
a = (MapArea *) al->ptr;
if (!(a && i == n))
continue;
- s = Sprintf("[%s]", a->alt);
- if (*a->alt) {
+ if (*a->alt)
+ s = Sprintf("[%s]", a->alt);
+ if (*a->url) {
ParsedURL pu;
parseURL2(a->url, &pu, baseURL(buf));
- Strcat_char(s, ' ');
+ if (s)
+ Strcat_char(s, ' ');
+ else
+ s = Strnew();
Strcat(s, parsedURL2Str(&pu));
}
return s;
@@ -280,8 +284,9 @@ follow_map_panel(Buffer *buf, char *name)
continue;
parseURL2(a->url, &pu, baseURL(buf));
url = html_quote(parsedURL2Str(&pu)->ptr);
- Strcat_m_charp(mappage, "<tr><td>", html_quote(a->alt),
- "<td><a href=\"", url, "\">", url, "</a>\n", NULL);
+ Strcat_m_charp(mappage, "<tr><td><a href=\"", url, "\">",
+ html_quote(*a->alt ? a->alt : mybasename(a->url)),
+ "</a><td>", url, NULL);
}
Strcat_charp(mappage, "</table></body></html>");
@@ -409,8 +414,8 @@ append_map_info(Buffer *buf, Str tmp, FormItemList *fi)
parseURL2(a->url, &pu, baseURL(buf));
url = html_quote(parsedURL2Str(&pu)->ptr);
Strcat_m_charp(tmp, "<tr><td> <td><a href=\"", url, "\">",
- html_quote(a->alt), "</a><td>", html_quote(a->url),
- "\n", NULL);
+ html_quote(*a->alt ? a->alt : mybasename(a->url)),
+ "</a><td>", html_quote(a->url), "\n", NULL);
}
Strcat_charp(tmp, "</table>");
}