[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>
This commit is contained in:
Fumitoshi UKAI
2002-11-27 16:39:13 +00:00
parent 09c3eb83b9
commit 7b5f6ea99c
3 changed files with 45 additions and 7 deletions
+9 -1
View File
@@ -1,3 +1,11 @@
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
@@ -5226,4 +5234,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1
* import w3m-0.2.1
$Id: ChangeLog,v 1.568 2002/11/27 16:35:18 ukai Exp $
$Id: ChangeLog,v 1.569 2002/11/27 16:39:13 ukai Exp $
+12 -3
View File
@@ -1,4 +1,4 @@
/* $Id: etc.c,v 1.40 2002/11/24 16:02:22 ukai Exp $ */
/* $Id: etc.c,v 1.41 2002/11/27 16:39:17 ukai Exp $ */
#include "fm.h"
#include <pwd.h>
#include "myctype.h"
@@ -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, "&lt;");
*/
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;
}
}
+24 -3
View File
@@ -1,4 +1,4 @@
/* $Id: file.c,v 1.132 2002/11/26 18:03:24 ukai Exp $ */
/* $Id: file.c,v 1.133 2002/11/27 16:39:18 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
#include "myctype.h"
@@ -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("&lt;", 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) {