w3m

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

commit ec07a9d1656be38973d1d9ec749d5182815c5c77
parent 604f7cb03ba7d450d76f875887bbb3165723b0fa
Author: ukai <ukai>
Date:   Mon,  9 Dec 2002 15:40:34 +0000

[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>

Diffstat:
MChangeLog | 21+++++++++++++++++++++
Mfile.c | 74++++++++++++++++++++++++++++++++++++++++++--------------------------------
Mhtml.c | 2++
Mhtml.h | 4+++-
Mtagtable.tab | 2++
5 files changed, 70 insertions(+), 33 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,5 +1,26 @@ 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> + * [w3m-dev 03544] Can't display "1&2" in table * file.c (HTMLlineproc0): continue -> R_ST_NORMAL diff --git a/file.c b/file.c @@ -2992,13 +2992,13 @@ process_img(struct parsed_tag *tag, int width) if (use_image) { switch (align) { case ALIGN_LEFT: - Strcat_charp(tmp, "<div align=left>"); + Strcat_charp(tmp, "<div_int align=left>"); break; case ALIGN_CENTER: - Strcat_charp(tmp, "<div align=center>"); + Strcat_charp(tmp, "<div_int align=center>"); break; case ALIGN_RIGHT: - Strcat_charp(tmp, "<div align=right>"); + Strcat_charp(tmp, "<div_int align=right>"); break; } } @@ -3225,7 +3225,7 @@ process_img(struct parsed_tag *tag, int width) case ALIGN_RIGHT: case ALIGN_CENTER: case ALIGN_LEFT: - Strcat_charp(tmp, "</div>"); + Strcat_charp(tmp, "</div_int>"); break; } } @@ -3708,13 +3708,13 @@ process_hr(struct parsed_tag *tag, int width, int indent_width) parsedtag_get_value(tag, ATTR_ALIGN, &x); switch (x) { case ALIGN_CENTER: - Strcat_charp(tmp, "<div align=center>"); + Strcat_charp(tmp, "<div_int align=center>"); break; case ALIGN_RIGHT: - Strcat_charp(tmp, "<div align=right>"); + Strcat_charp(tmp, "<div_int align=right>"); break; case ALIGN_LEFT: - Strcat_charp(tmp, "<div align=left>"); + Strcat_charp(tmp, "<div_int align=left>"); break; } #ifndef KANJI_SYMBOLS @@ -3729,7 +3729,7 @@ process_hr(struct parsed_tag *tag, int width, int indent_width) #ifndef KANJI_SYMBOLS Strcat_charp(tmp, "</_RULE>"); #endif /* not KANJI_SYMBOLS */ - Strcat_charp(tmp, "</div></nobr>"); + Strcat_charp(tmp, "</div_int></nobr>"); 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) { \ flushline(h_env, obuf, envs[h_env->envc].indent,0,h_env->limit);\ RB_RESTORE_FLAG(obuf);\ - close_anchor(h_env, obuf);\ obuf->flag &= ~RB_P;\ } +#define CLOSE_A \ + CLOSE_P; \ + close_anchor(h_env, obuf); + #define CLOSE_DT \ if (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; case HTML_P: case HTML_N_P: - CLOSE_P; + CLOSE_A; if (!(obuf->flag & RB_IGNORE_P)) { flushline(h_env, obuf, envs[h_env->envc].indent, 1, h_env->limit); 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_OL: case HTML_BLQ: - CLOSE_P; + CLOSE_A; if (!(obuf->flag & RB_IGNORE_P)) { flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); 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_BLQ: CLOSE_DT; - CLOSE_P; + CLOSE_A; if (h_env->envc > 0) { flushline(h_env, obuf, envs[h_env->envc - 1].indent, 0, h_env->limit); @@ -4150,7 +4153,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) close_anchor(h_env, obuf); return 1; case HTML_DL: - CLOSE_P; + CLOSE_A; if (!(obuf->flag & RB_IGNORE_P)) { flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); 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; return 1; case HTML_LI: - CLOSE_P; + CLOSE_A; CLOSE_DT; if (h_env->envc > 0) { Str num; @@ -4242,7 +4245,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) obuf->flag |= RB_IGNORE_P; return 1; case HTML_DT: - CLOSE_P; + CLOSE_A; if (h_env->envc == 0 || (h_env->envc_real < h_env->nenv && 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; return 1; case HTML_DD: - CLOSE_P; + CLOSE_A; CLOSE_DT; if (envs[h_env->envc].env == HTML_DL_COMPACT) { 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; case HTML_NOFRAMES: - CLOSE_P; + CLOSE_A; flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); obuf->flag |= (RB_NOFRAMES | RB_IGNORE_P); /* istr = str; */ return 1; case HTML_N_NOFRAMES: - CLOSE_P; + CLOSE_A; flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); obuf->flag &= ~RB_NOFRAMES; return 1; @@ -4342,8 +4345,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) return 1; case HTML_PRE: x = parsedtag_exists(tag, ATTR_FOR_TABLE); - if (!x) - CLOSE_P; + CLOSE_A; if (!(obuf->flag & RB_IGNORE_P)) { flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); if (!x) @@ -4353,7 +4355,6 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) else fillline(obuf, envs[h_env->envc].indent); obuf->flag |= (RB_PRE | RB_IGNORE_P); - close_anchor(h_env, obuf); /* istr = str; */ return 1; case HTML_N_PRE: @@ -4393,17 +4394,16 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) obuf->flag &= ~RB_NOBR; return 0; case HTML_PRE_PLAIN: - CLOSE_P; + CLOSE_A; if (!(obuf->flag & RB_IGNORE_P)) { flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); do_blankline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); } obuf->flag |= (RB_PRE | RB_IGNORE_P); - close_anchor(h_env, obuf); return 1; case HTML_N_PRE_PLAIN: - CLOSE_P; + CLOSE_A; if (!(obuf->flag & RB_IGNORE_P)) { flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); 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_XMP: case HTML_PLAINTEXT: - CLOSE_P; + CLOSE_A; if (!(obuf->flag & RB_IGNORE_P)) { flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); 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; break; } - close_anchor(h_env, obuf); return 1; case HTML_N_LISTING: case HTML_N_XMP: - CLOSE_P; + CLOSE_A; if (!(obuf->flag & RB_IGNORE_P)) { flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); 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() */ return 1; case HTML_CENTER: - CLOSE_P; + CLOSE_A; if (!(obuf->flag & (RB_PREMODE | RB_IGNORE_P))) flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); RB_SAVE_FLAG(obuf); RB_SET_ALIGN(obuf, RB_CENTER); return 1; case HTML_N_CENTER: - CLOSE_P; + CLOSE_A; if (!(obuf->flag & RB_PREMODE)) flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); RB_RESTORE_FLAG(obuf); return 1; case HTML_DIV: - CLOSE_P; + CLOSE_A; 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: + 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; flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); RB_RESTORE_FLAG(obuf); return 1; case HTML_FORM: - CLOSE_P; + CLOSE_A; if (!(obuf->flag & RB_IGNORE_P)) flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); tmp = process_form(tag); @@ -4620,7 +4630,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) HTMLlineproc1(tmp->ptr, h_env); return 1; case HTML_N_FORM: - CLOSE_P; + CLOSE_A; flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); obuf->flag |= RB_IGNORE_P; process_n_form(); diff --git a/html.c b/html.c @@ -254,6 +254,8 @@ TagInfo TagMAP[MAX_HTMLTAG] = { {"/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 | 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] = { diff --git a/html.h b/html.h @@ -218,8 +218,10 @@ typedef struct { #define HTML_N_PRE_PLAIN 128 #define HTML_INTERNAL 129 #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 */ diff --git a/tagtable.tab b/tagtable.tab @@ -168,3 +168,5 @@ textarea_int HTML_TEXTAREA_INT /textarea_int HTML_N_TEXTAREA_INT pre_plain HTML_PRE_PLAIN /pre_plain HTML_N_PRE_PLAIN +div_int HTML_DIV_INT +/div_int HTML_N_DIV_INT