aboutsummaryrefslogtreecommitdiffstats
path: root/parsetagx.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:23:02 +0000
committerTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:23:02 +0000
commit6db339b3d7a391f196e7c4b725a4ed0bd00f31cf (patch)
tree7d6fed976b72694d61fc595a745d394e1cd6e1a5 /parsetagx.c
parentAdding upstream version 0.5.1 (diff)
downloadw3m-ccf18a19b50f0eacd262d543e4afadc67ef14b31.tar.gz
w3m-ccf18a19b50f0eacd262d543e4afadc67ef14b31.zip
Adding upstream version 0.5.2upstream/0.5.2
Diffstat (limited to 'parsetagx.c')
-rw-r--r--parsetagx.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/parsetagx.c b/parsetagx.c
index 6bcc787..6b627d2 100644
--- a/parsetagx.c
+++ b/parsetagx.c
@@ -1,4 +1,4 @@
-/* $Id: parsetagx.c,v 1.14 2003/02/05 16:44:00 ukai Exp $ */
+/* $Id: parsetagx.c,v 1.18 2006/06/07 03:52:03 inu Exp $ */
#include "fm.h"
#include "myctype.h"
#include "indep.h"
@@ -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,14 +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);
+ Strcat_char(value_tmp, *q);
if (!tag->need_reconstruct && is_html_quote(*q))
tag->need_reconstruct = TRUE;
q++;
@@ -192,8 +191,7 @@ parse_tag(char **s, int internal)
else if (*q == '\'') {
q++;
while (*q && *q != '\'') {
- if (*q != '\n')
- Strcat_char(value, *q);
+ Strcat_char(value_tmp, *q);
if (!tag->need_reconstruct && is_html_quote(*q))
tag->need_reconstruct = TRUE;
q++;
@@ -203,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++;
@@ -218,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) ||