From e312638d0c8d64fe85db128d0eb8c3885a8bfe88 Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Wed, 5 Feb 2003 16:43:56 +0000 Subject: [w3m-dev 03730] display decoded URL * anchor.c (link_list_panel): support DecodeURL * display.c (make_lastline_link): support DecodeURL * etc.c (url_unquote_conv): added * fm.h (DecodeURL): added * history.c (historyBuffer): support DecodeURL * indep.c (QUOTE_MAP): added (HTML_QUOTE_MAP): added (html_quote_char): deleted (url_quote): use is_url_quote (file_quote): use is_file_quote (is_url_safe): deleted (Str_form_quote): use is_url_unsafe (Str_url_unquote): add safe args (is_shell_safe): delete (shell_quote): use is_shell_unsafe * indep.h (QUOTE_MAP): added (HTML_QUOTE_MAP): added (HTML_QUOTE_MASK): added (SHELL_UNSAFE_MASK): added (URL_QUOTE_MASK): added (FILE_QUOTE_MASK): added (URL_UNSAFE_MASK): added (GET_QUOTE_TYPE): added (is_html_quote): added (is_shell_unsafe): added (is_url_quote): added (is_file_quote): added (is_url_unsafe): added (html_quote_char): added (html_quote_char): deleted (Str_url_unquote): added safe (form_unquote): Str_url_unquote changes * linein.c (_prev): support DecodeURL (_next): ditto * main.c (goURL0): support DecodeURL (_peekURL): ditto (curURL): ditto * map.c (follow_map_panel): support DecodeURL (append_map_info): ditto (append_link_info): ditto (append_frame_info): ditto (page_info_panel): ditto * menu.c (initSelectMenu): delete SCM_LOCAL_CGI support DecodeURL (initSelTabMenu): delete SCM_LOCAL_CGI support DecodeURL (link_menu): support DecodeURL * parsetagx.c (parse_tag): is_html_quote * proto.h (url_unquote_conv): added * rc.c (CMT_DECODE_URL): added (params1): add decode_url * url.c (openURL): Str_url_unquote non safe From: Hironori SAKAMOTO --- anchor.c | 60 +++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 15 deletions(-) (limited to 'anchor.c') diff --git a/anchor.c b/anchor.c index 8c2e955..63a20f9 100644 --- a/anchor.c +++ b/anchor.c @@ -1,4 +1,4 @@ -/* $Id: anchor.c,v 1.22 2003/02/05 16:23:28 ukai Exp $ */ +/* $Id: anchor.c,v 1.23 2003/02/05 16:43:56 ukai Exp $ */ #include "fm.h" #include "myctype.h" #include "regex.h" @@ -685,7 +685,7 @@ link_list_panel(Buffer *buf) Anchor *a; FormItemList *fi; int i; - char *t, *u; + char *t, *u, *p; ParsedURL pu; Str tmp = Strnew_charp("Link List\

Link List

\n"); @@ -700,10 +700,15 @@ link_list_panel(Buffer *buf) for (l = buf->linklist; l; l = l->next) { if (l->url) { parseURL2(l->url, &pu, baseURL(buf)); - u = html_quote(parsedURL2Str(&pu)->ptr); + p = parsedURL2Str(&pu)->ptr; + u = html_quote(p); + if (DecodeURL) + p = html_quote(url_unquote_conv(p, buf->document_code)); + else + p = u; } else - u = ""; + u = p = ""; if (l->type == LINK_TYPE_REL) t = " [Rel]"; else if (l->type == LINK_TYPE_REV) @@ -712,7 +717,7 @@ link_list_panel(Buffer *buf) t = ""; t = Sprintf("%s%s\n", l->title ? l->title : "", t)->ptr; t = html_quote(t); - Strcat_m_charp(tmp, "
  • ", t, "
    ", u, + Strcat_m_charp(tmp, "
  • ", t, "
    ", p, "\n", NULL); } Strcat_charp(tmp, "\n"); @@ -726,10 +731,15 @@ link_list_panel(Buffer *buf) if (a->slave) continue; parseURL2(a->url, &pu, baseURL(buf)); - u = html_quote(parsedURL2Str(&pu)->ptr); + p = parsedURL2Str(&pu)->ptr; + u = html_quote(p); + if (DecodeURL) + p = html_quote(url_unquote_conv(p, buf->document_code)); + else + p = u; t = getAnchorText(buf, al, a); t = t ? html_quote(t) : ""; - Strcat_m_charp(tmp, "
  • ", t, "
    ", u, + Strcat_m_charp(tmp, "
  • ", t, "
    ", p, "\n", NULL); } Strcat_charp(tmp, "\n"); @@ -743,10 +753,19 @@ link_list_panel(Buffer *buf) if (a->slave) continue; parseURL2(a->url, &pu, baseURL(buf)); - u = html_quote(parsedURL2Str(&pu)->ptr); - t = (a->title && *a->title) ? html_quote(a->title) : - html_quote(a->url); - Strcat_m_charp(tmp, "
  • ", t, "
    ", u, + p = parsedURL2Str(&pu)->ptr; + u = html_quote(p); + if (DecodeURL) + p = html_quote(url_unquote_conv(p, buf->document_code)); + else + p = u; + if (a->title && *a->title) + t = html_quote(a->title); + else if (DecodeURL) + t = html_quote(url_unquote_conv(a->url, buf->document_code)); + else + t = html_quote(a->url); + Strcat_m_charp(tmp, "
  • ", t, "
    ", p, "\n", NULL); a = retrieveAnchor(buf->formitem, a->start.line, a->start.pos); if (!a) @@ -766,11 +785,22 @@ link_list_panel(Buffer *buf) if (!m) continue; parseURL2(m->url, &pu, baseURL(buf)); - u = html_quote(parsedURL2Str(&pu)->ptr); - t = (m->alt && *m->alt) ? html_quote(m->alt) : - html_quote(m->url); + p = parsedURL2Str(&pu)->ptr; + u = html_quote(p); + if (DecodeURL) + p = html_quote(url_unquote_conv(p, + buf->document_code)); + else + p = u; + if (m->alt && *m->alt) + t = html_quote(m->alt); + else if (DecodeURL) + t = html_quote(url_unquote_conv(m->url, + buf->document_code)); + else + t = html_quote(m->url); Strcat_m_charp(tmp, "
  • ", t, - "
    ", u, "\n", NULL); + "
    ", p, "\n", NULL); } Strcat_charp(tmp, "\n"); } -- cgit v1.2.3