commit ec7b65035d80699a52ea952208cf5f6cd8ef530f
parent 478871b9ea3d3696df91b7a043c25b26e018acad
Author: ukai <ukai>
Date: Wed, 27 Nov 2002 16:39:13 +0000
[w3m-dev 03496] parse <!-- ... --> in <script>
* etc.c (read_token): check <pre>
* file.c (HTMLlineproc0): remove comment processing
check pre mode
comment processing move
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat:
3 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,5 +1,13 @@
2002-11-28 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+ * [w3m-dev 03496] parse <!-- ... --> in <script>
+ * etc.c (read_token): check <pre>
+ * file.c (HTMLlineproc0): remove comment processing
+ check pre mode
+ comment processing move
+
+2002-11-28 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
* [w3m-dev 03495] local CGI can't work
* local.c: #include "hash.h"
(set_environ): env string put in hash
diff --git a/etc.c b/etc.c
@@ -755,8 +755,10 @@ read_token(Str buf, char **instr, int *status, int pre, int append)
}
if (prev_status == R_ST_NCMNT2 || prev_status == R_ST_NCMNT3 ||
prev_status == R_ST_IRRTAG || prev_status == R_ST_CMNT1) {
- if (prev_status == R_ST_CMNT1 && !append)
+ if (prev_status == R_ST_CMNT1 && !append && !pre)
Strclear(buf);
+ if (pre)
+ Strcat_char(buf, *p);
p++;
goto proc_end;
}
@@ -779,7 +781,10 @@ read_token(Str buf, char **instr, int *status, int pre, int append)
}
if (*status == R_ST_TAG0 && !REALLY_THE_BEGINNING_OF_A_TAG(p)) {
/* it seems that this '<' is not a beginning of a tag */
+/*
Strcat_charp(buf, "<");
+*/
+ Strcat_char(buf, '<');
*status = R_ST_NORMAL;
}
else
@@ -793,7 +798,9 @@ read_token(Str buf, char **instr, int *status, int pre, int append)
break;
case R_ST_CMNT:
case R_ST_IRRTAG:
- if (!append)
+ if (pre)
+ Strcat_char(buf, *p);
+ else if (!append)
Strclear(buf);
break;
case R_ST_CMNT1:
@@ -802,6 +809,8 @@ read_token(Str buf, char **instr, int *status, int pre, int append)
case R_ST_NCMNT2:
case R_ST_NCMNT3:
/* do nothing */
+ if (pre)
+ Strcat_char(buf, *p);
break;
}
}
diff --git a/file.c b/file.c
@@ -5421,6 +5421,7 @@ HTMLlineproc0(char *str, struct html_feed_environ *h_env, int internal)
fclose(f);
}
+#if 0
/* comment processing */
if (obuf->status == R_ST_CMNT || obuf->status == R_ST_NCMNT3 ||
obuf->status == R_ST_IRRTAG) {
@@ -5431,6 +5432,7 @@ HTMLlineproc0(char *str, struct html_feed_environ *h_env, int internal)
if (obuf->status != R_ST_NORMAL)
return;
}
+#endif
tokbuf = Strnew();
@@ -5444,13 +5446,25 @@ HTMLlineproc0(char *str, struct html_feed_environ *h_env, int internal)
while (*str != '\0') {
int is_tag = FALSE;
+ int pre_mode = (obuf->table_level >= 0) ?
+ tbl_mode->pre_mode & TBLM_PLAIN :
+ obuf->flag & RB_PLAINMODE;
if (obuf->flag & RB_PLAIN)
goto read_as_plain; /* don't process tag */
+ if (ST_IS_COMMENT(obuf->status)) {
+ read_token(h_env->tagbuf, &str, &obuf->status, pre_mode, 1);
+ if (obuf->status != R_ST_NORMAL)
+ return;
+ if (pre_mode) {
+ is_tag = TRUE;
+ q = h_env->tagbuf->ptr;
+ goto read_as_pre_mode;
+ }
+ continue;
+ }
if (*str == '<' || ST_IS_TAG(obuf->status)) {
- int pre_mode = (obuf->table_level >= 0) ?
- tbl_mode->pre_mode & TBLM_PLAIN : obuf->flag & RB_PLAINMODE;
/*
* Tag processing
*/
@@ -5462,12 +5476,15 @@ HTMLlineproc0(char *str, struct html_feed_environ *h_env, int internal)
if (!REALLY_THE_BEGINNING_OF_A_TAG(str)) {
/* this is NOT a beginning of a tag */
obuf->status = R_ST_NORMAL;
+ if (pre_mode)
+ goto read_as_pre_mode;
HTMLlineproc1("<", h_env);
str++;
continue;
}
read_token(h_env->tagbuf, &str, &obuf->status, pre_mode, 0);
}
+#if 0
if (ST_IS_COMMENT(obuf->status)) {
if ((obuf->table_level >= 0) ? tbl_mode->pre_mode & TBLM_IGNORE
: obuf->flag & RB_IGNORE)
@@ -5476,6 +5493,7 @@ HTMLlineproc0(char *str, struct html_feed_environ *h_env, int internal)
obuf->status = R_ST_NORMAL;
return;
}
+#endif
if (h_env->tagbuf->length == 0)
continue;
if (obuf->status != R_ST_NORMAL) {
@@ -5501,6 +5519,7 @@ HTMLlineproc0(char *str, struct html_feed_environ *h_env, int internal)
q = h_env->tagbuf->ptr;
}
+ read_as_pre_mode:
if (obuf->flag & (RB_INTXTA | RB_INSELECT | RB_IGNORE)) {
cmd = HTML_UNKNOWN;
if (!is_tag) {
@@ -5519,6 +5538,8 @@ HTMLlineproc0(char *str, struct html_feed_environ *h_env, int internal)
if (obuf->flag & RB_INTXTA) {
if (cmd == HTML_N_TEXTAREA)
goto proc_normal;
+ if (is_tag)
+ continue;
feed_textarea(q);
}
else if (obuf->flag & RB_INSELECT) {