w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

commit efcd19f917a2a78b368cde4852777d7addcb78c2
parent 65e44703223bfd58c0d4854da515080900ffb444
Author: inu <inu>
Date:   Wed,  7 Jun 2006 03:52:03 +0000

don't delete newlines in hidden values. [w3m-dev 04129]

Diffstat:
MChangeLog | 5+++++
Mparsetagx.c | 39++++++++++++++++++++++++++++-----------
2 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,8 @@ +2006-06-07 Dai Sato <satodai@w3m.jp> + + * [w3m-dev 04129] handling newlines in form values + * parsetagx.c: don't delete newlines in hidden values. + 2006-05-29 Dai Sato <satodai@w3m.jp> * [w3m-dev-en 01067] Some more patches diff --git a/parsetagx.c b/parsetagx.c @@ -159,7 +159,7 @@ parse_tag(char **s, int internal) /* Parse tag arguments */ SKIP_BLANKS(q); while (1) { - Str value = NULL; + Str value = NULL, value_tmp = NULL; if (*q == '>' || *q == '\0') goto done_parse_tag; p = attrname; @@ -174,16 +174,13 @@ parse_tag(char **s, int internal) SKIP_BLANKS(q); if (*q == '=') { /* get value */ - value = Strnew(); + value_tmp = Strnew(); q++; SKIP_BLANKS(q); if (*q == '"') { q++; while (*q && *q != '"') { - if (*q != '\n') - Strcat_char(value, *q); - else - Strcat_char(value, ' '); + Strcat_char(value_tmp, *q); if (!tag->need_reconstruct && is_html_quote(*q)) tag->need_reconstruct = TRUE; q++; @@ -194,10 +191,7 @@ parse_tag(char **s, int internal) else if (*q == '\'') { q++; while (*q && *q != '\'') { - if (*q != '\n') - Strcat_char(value, *q); - else - Strcat_char(value, ' '); + Strcat_char(value_tmp, *q); if (!tag->need_reconstruct && is_html_quote(*q)) tag->need_reconstruct = TRUE; q++; @@ -207,7 +201,7 @@ parse_tag(char **s, int internal) } else if (*q) { while (*q && !IS_SPACE(*q) && *q != '>') { - Strcat_char(value, *q); + Strcat_char(value_tmp, *q); if (!tag->need_reconstruct && is_html_quote(*q)) tag->need_reconstruct = TRUE; q++; @@ -222,6 +216,29 @@ parse_tag(char **s, int internal) break; } } + + if (value_tmp) { + int j, hidden=FALSE; + for (j=0; j<i; j++) { + if (tag->attrid[j] == ATTR_TYPE && + strcmp("hidden",tag->value[j]) == 0) { + hidden=TRUE; + break; + } + } + if ((tag_id == HTML_INPUT || tag_id == HTML_INPUT_ALT) && + attr_id == ATTR_VALUE && hidden) { + value = value_tmp; + } else { + char *x; + value = Strnew(); + for (x = value_tmp->ptr; *x; x++) { + if (*x != '\n') + Strcat_char(value, *x); + } + } + } + if (i != nattr) { if (!internal && ((AttrMAP[attr_id].flag & AFLG_INT) ||