w3m

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

commit 5af6784ee134004c99c1670373bda6c271e52769
parent 8ba13c66798d5acf1da756da3837dc6edc2fe729
Author: ukai <ukai>
Date:   Thu, 23 Jan 2003 18:01:01 +0000

* etc.c (next_status): after = is R_ST_VALUE
		R_ST_VALUE > => R_ST_NORMAL
		R_ST_VALUE SP => R_ST_TAG
	(read_token): R_ST_VALUE
	(correct_irrtag): R_ST_VALUE
* rm.h (R_ST_VALUE): added
	(ST_IS_REAL_TAG): rewrite
	(ST_IS_COMMENT): deleted
	(ST_IS_TAG): deleted
* parsetagx.c (parse_tag): skip too long tagname
			skip too long attrname
			if attrvalue has quote char, need reconstruct
			if unknown attr, need reconstruct
* table.c (visible_length): R_ST_VALUE
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>

Diffstat:
MChangeLog | 17+++++++++++++++++
Metc.c | 10+++++++++-
Mfm.h | 5++---
Mparsetagx.c | 20++++++++++++++------
Mtable.c | 3++-
5 files changed, 44 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,5 +1,22 @@ 2003-01-24 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * etc.c (next_status): after = is R_ST_VALUE + R_ST_VALUE > => R_ST_NORMAL + R_ST_VALUE SP => R_ST_TAG + (read_token): R_ST_VALUE + (correct_irrtag): R_ST_VALUE + * rm.h (R_ST_VALUE): added + (ST_IS_REAL_TAG): rewrite + (ST_IS_COMMENT): deleted + (ST_IS_TAG): deleted + * parsetagx.c (parse_tag): skip too long tagname + skip too long attrname + if attrvalue has quote char, need reconstruct + if unknown attr, need reconstruct + * table.c (visible_length): R_ST_VALUE + +2003-01-24 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> + * [w3m-dev 03680] showProgress() on fast system * file.c (showProgress): check line len, time diff --git a/etc.c b/etc.c @@ -636,7 +636,7 @@ next_status(char c, int *status) else if (c == '>') *status = R_ST_NORMAL; else - *status = R_ST_TAG; + *status = R_ST_VALUE; return 0; case R_ST_QUOTE: if (c == '\'') @@ -646,6 +646,12 @@ next_status(char c, int *status) if (c == '"') *status = R_ST_TAG; return 0; + case R_ST_VALUE: + if (c == '>') + *status = R_ST_NORMAL; + else if (IS_SPACE(c)) + *status = R_ST_TAG; + return 0; case R_ST_AMP: if (c == ';') { *status = R_ST_NORMAL; @@ -792,6 +798,7 @@ read_token(Str buf, char **instr, int *status, int pre, int append) case R_ST_EQL: case R_ST_QUOTE: case R_ST_DQUOTE: + case R_ST_VALUE: case R_ST_AMP: Strcat_char(buf, *p); break; @@ -838,6 +845,7 @@ correct_irrtag(int status) case R_ST_TAG: case R_ST_TAG0: case R_ST_EQL: /* required ">" */ + case R_ST_VALUE: c = '>'; break; case R_ST_QUOTE: diff --git a/fm.h b/fm.h @@ -623,10 +623,9 @@ struct readbuffer { #define R_ST_NCMNT2 12 /* comment -- */ #define R_ST_NCMNT3 13 /* comment -- space */ #define R_ST_IRRTAG 14 /* within irregular tag */ +#define R_ST_VALUE 15 /* within tag attribule value */ -#define ST_IS_REAL_TAG(s) ((s)==R_ST_TAG||(s)==R_ST_TAG0||(s)==R_ST_EQL) -#define ST_IS_COMMENT(s) ((s)>=R_ST_CMNT1) -#define ST_IS_TAG(s) ((s)!=R_ST_NORMAL&&(s)!=R_ST_AMP&&!ST_IS_COMMENT(s)&&(s)!=R_ST_EOL) +#define ST_IS_REAL_TAG(s) ((s)==R_ST_TAG||(s)==R_ST_TAG0||(s)==R_ST_EQL||(s)==R_ST_VALUE) /* is this '<' really means the beginning of a tag? */ #define REALLY_THE_BEGINNING_OF_A_TAG(p) \ diff --git a/parsetagx.c b/parsetagx.c @@ -132,6 +132,9 @@ parse_tag(char **s, int internal) q++; } *p = '\0'; + while (*q && !IS_SPACE(*q) && !(tagname[0] != '/' && *q == '/') && + *q != '>') + q++; tag_id = getHash_si(&tagtable, tagname, HTML_UNKNOWN); @@ -165,11 +168,9 @@ parse_tag(char **s, int internal) *(p++) = TOLOWER(*q); q++; } - if (q == p) { - q++; - continue; - } *p = '\0'; + while (*q && *q != '=' && !IS_SPACE(*q) && *q != '>') + q++; SKIP_BLANKS(q); if (*q == '=') { /* get value */ @@ -201,8 +202,12 @@ parse_tag(char **s, int internal) q++; } else if (*q) { - while (*q && !IS_SPACE(*q) && *q != '>') - Strcat_char(value, *q++); + while (*q && !IS_SPACE(*q) && *q != '>') { + Strcat_char(value, *q); + if (!tag->need_reconstruct && html_quote_char(*q)) + tag->need_reconstruct = TRUE; + q++; + } } } for (i = 0; i < nattr; i++) { @@ -227,6 +232,9 @@ parse_tag(char **s, int internal) else tag->value[i] = NULL; } + else { + tag->need_reconstruct = TRUE; + } } skip_parse_tagarg: diff --git a/table.c b/table.c @@ -484,7 +484,8 @@ visible_length(char *str) Strcat_char(tagbuf, *str); } else if (status == R_ST_TAG || status == R_ST_DQUOTE - || status == R_ST_QUOTE || status == R_ST_EQL) { + || status == R_ST_QUOTE || status == R_ST_EQL + || status == R_ST_VALUE) { Strcat_char(tagbuf, *str); } else if (status == R_ST_AMP) {