[w3m-dev 03548] close anchor before <img align=...>

* file.c (process_img): use div_int
	(process_hr): use div_int
	(process_idattr): don't close_anchor
	(CLOSE_A): added
	(HTMLtagproc1): </p> close anchor
	  <dl>,<ul>,<ol>,<blockquote>,<li>,<dt>,<dd> close anchor
	  <noframes> close anchor
	  <pre> close anchor
	  <center> close anchor
	  <div> close anchor
	  add DIV_INT
	  <form> close anchor
* html.c (TagMAP): add div_int
* html.h (HTML_DIV_INT): added
	(HTML_N_DIV_INT): added
* tagtable.tab (div_int): added
		(/div_int): added
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
This commit is contained in:
Fumitoshi UKAI
2002-12-09 15:40:34 +00:00
parent d2c8b1d1fc
commit 4c89fd63aa
5 changed files with 74 additions and 37 deletions
+22 -1
View File
@@ -1,3 +1,24 @@
2002-12-10 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03548] close anchor before <img align=...>
* file.c (process_img): use div_int
(process_hr): use div_int
(process_idattr): don't close_anchor
(CLOSE_A): added
(HTMLtagproc1): </p> close anchor
<dl>,<ul>,<ol>,<blockquote>,<li>,<dt>,<dd> close anchor
<noframes> close anchor
<pre> close anchor
<center> close anchor
<div> close anchor
add DIV_INT
<form> close anchor
* html.c (TagMAP): add div_int
* html.h (HTML_DIV_INT): added
(HTML_N_DIV_INT): added
* tagtable.tab (div_int): added
(/div_int): added
2002-12-10 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp> 2002-12-10 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03544] Can't display "1&2" in table * [w3m-dev 03544] Can't display "1&2" in table
@@ -5611,4 +5632,4 @@ a * [w3m-dev 03276] compile error on EWS4800
* release-0-2-1 * release-0-2-1
* import w3m-0.2.1 * import w3m-0.2.1
$Id: ChangeLog,v 1.604 2002/12/09 15:33:33 ukai Exp $ $Id: ChangeLog,v 1.605 2002/12/09 15:40:34 ukai Exp $
+43 -33
View File
@@ -1,4 +1,4 @@
/* $Id: file.c,v 1.156 2002/12/09 15:33:34 ukai Exp $ */ /* $Id: file.c,v 1.157 2002/12/09 15:40:35 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <sys/types.h> #include <sys/types.h>
#include "myctype.h" #include "myctype.h"
@@ -2992,13 +2992,13 @@ process_img(struct parsed_tag *tag, int width)
if (use_image) { if (use_image) {
switch (align) { switch (align) {
case ALIGN_LEFT: case ALIGN_LEFT:
Strcat_charp(tmp, "<div align=left>"); Strcat_charp(tmp, "<div_int align=left>");
break; break;
case ALIGN_CENTER: case ALIGN_CENTER:
Strcat_charp(tmp, "<div align=center>"); Strcat_charp(tmp, "<div_int align=center>");
break; break;
case ALIGN_RIGHT: case ALIGN_RIGHT:
Strcat_charp(tmp, "<div align=right>"); Strcat_charp(tmp, "<div_int align=right>");
break; break;
} }
} }
@@ -3225,7 +3225,7 @@ process_img(struct parsed_tag *tag, int width)
case ALIGN_RIGHT: case ALIGN_RIGHT:
case ALIGN_CENTER: case ALIGN_CENTER:
case ALIGN_LEFT: case ALIGN_LEFT:
Strcat_charp(tmp, "</div>"); Strcat_charp(tmp, "</div_int>");
break; break;
} }
} }
@@ -3708,13 +3708,13 @@ process_hr(struct parsed_tag *tag, int width, int indent_width)
parsedtag_get_value(tag, ATTR_ALIGN, &x); parsedtag_get_value(tag, ATTR_ALIGN, &x);
switch (x) { switch (x) {
case ALIGN_CENTER: case ALIGN_CENTER:
Strcat_charp(tmp, "<div align=center>"); Strcat_charp(tmp, "<div_int align=center>");
break; break;
case ALIGN_RIGHT: case ALIGN_RIGHT:
Strcat_charp(tmp, "<div align=right>"); Strcat_charp(tmp, "<div_int align=right>");
break; break;
case ALIGN_LEFT: case ALIGN_LEFT:
Strcat_charp(tmp, "<div align=left>"); Strcat_charp(tmp, "<div_int align=left>");
break; break;
} }
#ifndef KANJI_SYMBOLS #ifndef KANJI_SYMBOLS
@@ -3729,7 +3729,7 @@ process_hr(struct parsed_tag *tag, int width, int indent_width)
#ifndef KANJI_SYMBOLS #ifndef KANJI_SYMBOLS
Strcat_charp(tmp, "</_RULE>"); Strcat_charp(tmp, "</_RULE>");
#endif /* not KANJI_SYMBOLS */ #endif /* not KANJI_SYMBOLS */
Strcat_charp(tmp, "</div></nobr>"); Strcat_charp(tmp, "</div_int></nobr>");
return tmp; return tmp;
} }
@@ -3924,10 +3924,13 @@ process_idattr(struct readbuffer *obuf, int cmd, struct parsed_tag *tag)
#define CLOSE_P if (obuf->flag & RB_P) { \ #define CLOSE_P if (obuf->flag & RB_P) { \
flushline(h_env, obuf, envs[h_env->envc].indent,0,h_env->limit);\ flushline(h_env, obuf, envs[h_env->envc].indent,0,h_env->limit);\
RB_RESTORE_FLAG(obuf);\ RB_RESTORE_FLAG(obuf);\
close_anchor(h_env, obuf);\
obuf->flag &= ~RB_P;\ obuf->flag &= ~RB_P;\
} }
#define CLOSE_A \
CLOSE_P; \
close_anchor(h_env, obuf);
#define CLOSE_DT \ #define CLOSE_DT \
if (obuf->flag & RB_IN_DT) { \ if (obuf->flag & RB_IN_DT) { \
obuf->flag &= ~RB_IN_DT; \ obuf->flag &= ~RB_IN_DT; \
@@ -4067,7 +4070,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
return 1; return 1;
case HTML_P: case HTML_P:
case HTML_N_P: case HTML_N_P:
CLOSE_P; CLOSE_A;
if (!(obuf->flag & RB_IGNORE_P)) { if (!(obuf->flag & RB_IGNORE_P)) {
flushline(h_env, obuf, envs[h_env->envc].indent, 1, h_env->limit); flushline(h_env, obuf, envs[h_env->envc].indent, 1, h_env->limit);
do_blankline(h_env, obuf, envs[h_env->envc].indent, 0, do_blankline(h_env, obuf, envs[h_env->envc].indent, 0,
@@ -4105,7 +4108,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
case HTML_UL: case HTML_UL:
case HTML_OL: case HTML_OL:
case HTML_BLQ: case HTML_BLQ:
CLOSE_P; CLOSE_A;
if (!(obuf->flag & RB_IGNORE_P)) { if (!(obuf->flag & RB_IGNORE_P)) {
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
if (!(obuf->flag & RB_PREMODE) && if (!(obuf->flag & RB_PREMODE) &&
@@ -4134,7 +4137,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
case HTML_N_DL: case HTML_N_DL:
case HTML_N_BLQ: case HTML_N_BLQ:
CLOSE_DT; CLOSE_DT;
CLOSE_P; CLOSE_A;
if (h_env->envc > 0) { if (h_env->envc > 0) {
flushline(h_env, obuf, envs[h_env->envc - 1].indent, 0, flushline(h_env, obuf, envs[h_env->envc - 1].indent, 0,
h_env->limit); h_env->limit);
@@ -4150,7 +4153,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
close_anchor(h_env, obuf); close_anchor(h_env, obuf);
return 1; return 1;
case HTML_DL: case HTML_DL:
CLOSE_P; CLOSE_A;
if (!(obuf->flag & RB_IGNORE_P)) { if (!(obuf->flag & RB_IGNORE_P)) {
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
if (!(obuf->flag & RB_PREMODE)) if (!(obuf->flag & RB_PREMODE))
@@ -4163,7 +4166,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
obuf->flag |= RB_IGNORE_P; obuf->flag |= RB_IGNORE_P;
return 1; return 1;
case HTML_LI: case HTML_LI:
CLOSE_P; CLOSE_A;
CLOSE_DT; CLOSE_DT;
if (h_env->envc > 0) { if (h_env->envc > 0) {
Str num; Str num;
@@ -4242,7 +4245,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
obuf->flag |= RB_IGNORE_P; obuf->flag |= RB_IGNORE_P;
return 1; return 1;
case HTML_DT: case HTML_DT:
CLOSE_P; CLOSE_A;
if (h_env->envc == 0 || if (h_env->envc == 0 ||
(h_env->envc_real < h_env->nenv && (h_env->envc_real < h_env->nenv &&
envs[h_env->envc].env != HTML_DL && envs[h_env->envc].env != HTML_DL &&
@@ -4260,7 +4263,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
obuf->flag |= RB_IGNORE_P; obuf->flag |= RB_IGNORE_P;
return 1; return 1;
case HTML_DD: case HTML_DD:
CLOSE_P; CLOSE_A;
CLOSE_DT; CLOSE_DT;
if (envs[h_env->envc].env == HTML_DL_COMPACT) { if (envs[h_env->envc].env == HTML_DL_COMPACT) {
if (obuf->pos > envs[h_env->envc].indent) if (obuf->pos > envs[h_env->envc].indent)
@@ -4309,13 +4312,13 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
} }
return 0; return 0;
case HTML_NOFRAMES: case HTML_NOFRAMES:
CLOSE_P; CLOSE_A;
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
obuf->flag |= (RB_NOFRAMES | RB_IGNORE_P); obuf->flag |= (RB_NOFRAMES | RB_IGNORE_P);
/* istr = str; */ /* istr = str; */
return 1; return 1;
case HTML_N_NOFRAMES: case HTML_N_NOFRAMES:
CLOSE_P; CLOSE_A;
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
obuf->flag &= ~RB_NOFRAMES; obuf->flag &= ~RB_NOFRAMES;
return 1; return 1;
@@ -4342,8 +4345,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
return 1; return 1;
case HTML_PRE: case HTML_PRE:
x = parsedtag_exists(tag, ATTR_FOR_TABLE); x = parsedtag_exists(tag, ATTR_FOR_TABLE);
if (!x) CLOSE_A;
CLOSE_P;
if (!(obuf->flag & RB_IGNORE_P)) { if (!(obuf->flag & RB_IGNORE_P)) {
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
if (!x) if (!x)
@@ -4353,7 +4355,6 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
else else
fillline(obuf, envs[h_env->envc].indent); fillline(obuf, envs[h_env->envc].indent);
obuf->flag |= (RB_PRE | RB_IGNORE_P); obuf->flag |= (RB_PRE | RB_IGNORE_P);
close_anchor(h_env, obuf);
/* istr = str; */ /* istr = str; */
return 1; return 1;
case HTML_N_PRE: case HTML_N_PRE:
@@ -4393,17 +4394,16 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
obuf->flag &= ~RB_NOBR; obuf->flag &= ~RB_NOBR;
return 0; return 0;
case HTML_PRE_PLAIN: case HTML_PRE_PLAIN:
CLOSE_P; CLOSE_A;
if (!(obuf->flag & RB_IGNORE_P)) { if (!(obuf->flag & RB_IGNORE_P)) {
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
do_blankline(h_env, obuf, envs[h_env->envc].indent, 0, do_blankline(h_env, obuf, envs[h_env->envc].indent, 0,
h_env->limit); h_env->limit);
} }
obuf->flag |= (RB_PRE | RB_IGNORE_P); obuf->flag |= (RB_PRE | RB_IGNORE_P);
close_anchor(h_env, obuf);
return 1; return 1;
case HTML_N_PRE_PLAIN: case HTML_N_PRE_PLAIN:
CLOSE_P; CLOSE_A;
if (!(obuf->flag & RB_IGNORE_P)) { if (!(obuf->flag & RB_IGNORE_P)) {
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
do_blankline(h_env, obuf, envs[h_env->envc].indent, 0, do_blankline(h_env, obuf, envs[h_env->envc].indent, 0,
@@ -4415,7 +4415,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
case HTML_LISTING: case HTML_LISTING:
case HTML_XMP: case HTML_XMP:
case HTML_PLAINTEXT: case HTML_PLAINTEXT:
CLOSE_P; CLOSE_A;
if (!(obuf->flag & RB_IGNORE_P)) { if (!(obuf->flag & RB_IGNORE_P)) {
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
do_blankline(h_env, obuf, envs[h_env->envc].indent, 0, do_blankline(h_env, obuf, envs[h_env->envc].indent, 0,
@@ -4433,11 +4433,10 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
obuf->end_tag = MAX_HTMLTAG; obuf->end_tag = MAX_HTMLTAG;
break; break;
} }
close_anchor(h_env, obuf);
return 1; return 1;
case HTML_N_LISTING: case HTML_N_LISTING:
case HTML_N_XMP: case HTML_N_XMP:
CLOSE_P; CLOSE_A;
if (!(obuf->flag & RB_IGNORE_P)) { if (!(obuf->flag & RB_IGNORE_P)) {
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
do_blankline(h_env, obuf, envs[h_env->envc].indent, 0, do_blankline(h_env, obuf, envs[h_env->envc].indent, 0,
@@ -4588,31 +4587,42 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
/* should be processed in HTMLlineproc() */ /* should be processed in HTMLlineproc() */
return 1; return 1;
case HTML_CENTER: case HTML_CENTER:
CLOSE_P; CLOSE_A;
if (!(obuf->flag & (RB_PREMODE | RB_IGNORE_P))) if (!(obuf->flag & (RB_PREMODE | RB_IGNORE_P)))
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
RB_SAVE_FLAG(obuf); RB_SAVE_FLAG(obuf);
RB_SET_ALIGN(obuf, RB_CENTER); RB_SET_ALIGN(obuf, RB_CENTER);
return 1; return 1;
case HTML_N_CENTER: case HTML_N_CENTER:
CLOSE_P; CLOSE_A;
if (!(obuf->flag & RB_PREMODE)) if (!(obuf->flag & RB_PREMODE))
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
RB_RESTORE_FLAG(obuf); RB_RESTORE_FLAG(obuf);
return 1; return 1;
case HTML_DIV: case HTML_DIV:
CLOSE_P; CLOSE_A;
if (!(obuf->flag & RB_IGNORE_P)) if (!(obuf->flag & RB_IGNORE_P))
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
set_alignment(obuf, tag); set_alignment(obuf, tag);
return 1; return 1;
case HTML_N_DIV: case HTML_N_DIV:
CLOSE_A;
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
RB_RESTORE_FLAG(obuf);
return 1;
case HTML_DIV_INT:
CLOSE_P;
if (!(obuf->flag & RB_IGNORE_P))
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
set_alignment(obuf, tag);
return 1;
case HTML_N_DIV_INT:
CLOSE_P; CLOSE_P;
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
RB_RESTORE_FLAG(obuf); RB_RESTORE_FLAG(obuf);
return 1; return 1;
case HTML_FORM: case HTML_FORM:
CLOSE_P; CLOSE_A;
if (!(obuf->flag & RB_IGNORE_P)) if (!(obuf->flag & RB_IGNORE_P))
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
tmp = process_form(tag); tmp = process_form(tag);
@@ -4620,7 +4630,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
HTMLlineproc1(tmp->ptr, h_env); HTMLlineproc1(tmp->ptr, h_env);
return 1; return 1;
case HTML_N_FORM: case HTML_N_FORM:
CLOSE_P; CLOSE_A;
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
obuf->flag |= RB_IGNORE_P; obuf->flag |= RB_IGNORE_P;
process_n_form(); process_n_form();
+3 -1
View File
@@ -1,4 +1,4 @@
/* $Id: html.c,v 1.21 2002/12/08 14:23:44 ukai Exp $ */ /* $Id: html.c,v 1.22 2002/12/09 15:40:36 ukai Exp $ */
#include "html.h" #include "html.h"
/* Define HTML Tag Infomation Table */ /* Define HTML Tag Infomation Table */
@@ -254,6 +254,8 @@ TagInfo TagMAP[MAX_HTMLTAG] = {
{"/pre_plain", NULL, 0, TFLG_INT | TFLG_END}, /* 128 HTML_N_PRE_PLAIN */ {"/pre_plain", NULL, 0, TFLG_INT | TFLG_END}, /* 128 HTML_N_PRE_PLAIN */
{"internal", NULL, 0, TFLG_INT}, /* 129 HTML_INTERNAL */ {"internal", NULL, 0, TFLG_INT}, /* 129 HTML_INTERNAL */
{"/internal", NULL, 0, TFLG_INT | TFLG_END}, /* 130 HTML_N_INTERNAL */ {"/internal", NULL, 0, TFLG_INT | TFLG_END}, /* 130 HTML_N_INTERNAL */
{"div_int", ALST_P, MAXA_P, TFLG_INT}, /* 131 HTML_DIV_INT */
{"/div_int", NULL, 0, TFLG_INT | TFLG_END}, /* 132 HTML_N_DIV_INT */
}; };
TagAttrInfo AttrMAP[MAX_TAGATTR] = { TagAttrInfo AttrMAP[MAX_TAGATTR] = {
+4 -2
View File
@@ -1,4 +1,4 @@
/* $Id: html.h,v 1.14 2002/12/06 16:50:28 ukai Exp $ */ /* $Id: html.h,v 1.15 2002/12/09 15:40:37 ukai Exp $ */
#ifndef _HTML_H #ifndef _HTML_H
#define _HTML_H #define _HTML_H
#ifdef USE_SSL #ifdef USE_SSL
@@ -218,8 +218,10 @@ typedef struct {
#define HTML_N_PRE_PLAIN 128 #define HTML_N_PRE_PLAIN 128
#define HTML_INTERNAL 129 #define HTML_INTERNAL 129
#define HTML_N_INTERNAL 130 #define HTML_N_INTERNAL 130
#define HTML_DIV_INT 131
#define HTML_N_DIV_INT 132
#define MAX_HTMLTAG 131 #define MAX_HTMLTAG 133
/* Tag attribute */ /* Tag attribute */
+2
View File
@@ -168,3 +168,5 @@ textarea_int HTML_TEXTAREA_INT
/textarea_int HTML_N_TEXTAREA_INT /textarea_int HTML_N_TEXTAREA_INT
pre_plain HTML_PRE_PLAIN pre_plain HTML_PRE_PLAIN
/pre_plain HTML_N_PRE_PLAIN /pre_plain HTML_N_PRE_PLAIN
div_int HTML_DIV_INT
/div_int HTML_N_DIV_INT