aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2021-02-13 15:51:48 +0000
committerbptato <nincsnevem662@gmail.com>2021-02-13 15:51:48 +0000
commitb2081866fd6d5e03cc672d7f0c71e35446a07747 (patch)
treee9d82be0d0bda48b382b87c5d5e48a1ceecfffba
parentUpdate ChangeLog (diff)
downloadw3m-b2081866fd6d5e03cc672d7f0c71e35446a07747.tar.gz
w3m-b2081866fd6d5e03cc672d7f0c71e35446a07747.zip
Improve description list rendering
Diffstat (limited to '')
-rw-r--r--file.c30
-rw-r--r--html.c3
-rw-r--r--html.h2
-rw-r--r--tagtable.tab2
4 files changed, 28 insertions, 9 deletions
diff --git a/file.c b/file.c
index 79f140a..0cf9b4e 100644
--- a/file.c
+++ b/file.c
@@ -4662,7 +4662,6 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
do_blankline(h_env, obuf, envs[h_env->envc].indent, 0,
h_env->limit);
}
- PUSH_ENV(cmd);
if (parsedtag_exists(tag, ATTR_COMPACT))
envs[h_env->envc].env = HTML_DL_COMPACT;
obuf->flag |= RB_IGNORE_P;
@@ -4754,15 +4753,14 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
return 1;
case HTML_DT:
CLOSE_A;
- if (h_env->envc == 0 ||
- (h_env->envc_real < h_env->nenv &&
- envs[h_env->envc].env != HTML_DL &&
- envs[h_env->envc].env != HTML_DL_COMPACT)) {
- PUSH_ENV(HTML_DL);
+ if (h_env->envc > 0 &&
+ (envs[h_env->envc].env == HTML_DL ||
+ envs[h_env->envc].env == HTML_DL_COMPACT)) {
+ POP_ENV;
}
- if (h_env->envc > 0) {
+ if (h_env->envc >= 0) {
flushline(h_env, obuf,
- envs[h_env->envc - 1].indent, 0, h_env->limit);
+ envs[h_env->envc].indent, 0, h_env->limit);
}
if (!(obuf->flag & RB_IN_DT)) {
HTMLlineproc1("<b>", h_env);
@@ -4770,6 +4768,14 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
}
obuf->flag |= RB_IGNORE_P;
return 1;
+ case HTML_N_DT:
+ if (!(obuf->flag & RB_IN_DT))
+ return 1;
+ obuf->flag &= ~RB_IN_DT;
+ HTMLlineproc1("</b>", h_env);
+ flushline(h_env, obuf, envs[h_env->envc].indent, 0,
+ h_env->limit);
+ return 1;
case HTML_DD:
CLOSE_A;
CLOSE_DT;
@@ -4790,6 +4796,14 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
/* obuf->flag |= RB_IGNORE_P; */
return 1;
+ case HTML_N_DD:
+ if (h_env->envc > 0 &&
+ (envs[h_env->envc].env == HTML_DL ||
+ envs[h_env->envc].env == HTML_DL_COMPACT)) {
+ POP_ENV;
+ flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
+ }
+ return 1;
case HTML_TITLE:
close_anchor(h_env, obuf);
process_title(tag);
diff --git a/html.c b/html.c
index 7499191..5d25cd3 100644
--- a/html.c
+++ b/html.c
@@ -274,8 +274,9 @@ TagInfo TagMAP[MAX_HTMLTAG] = {
{"/figcaption", NULL, 0, TFLG_END}, /* 144 HTML_N_FIGCAPTION */
{"section", ALST_NOP, MAXA_NOP, 0}, /* 145 HTML_SECTION */
{"/section", NULL, 0, TFLG_END}, /* 146 HTML_N_SECTION */
+ {"/dt", NULL, 0, TFLG_END}, /* 147 HTML_N_DT */
+ {"/dd", NULL, 0, TFLG_END}, /* 147 HTML_N_DD */
- {NULL, NULL, 0, 0}, /* 147 Undefined */
{NULL, NULL, 0, 0}, /* 148 Undefined */
{NULL, NULL, 0, 0}, /* 149 Undefined */
{NULL, NULL, 0, 0}, /* 150 Undefined */
diff --git a/html.h b/html.h
index a03df19..749e7ef 100644
--- a/html.h
+++ b/html.h
@@ -238,6 +238,8 @@ typedef struct {
#define HTML_N_FIGCAPTION 144
#define HTML_SECTION 145
#define HTML_N_SECTION 146
+#define HTML_N_DT 147
+#define HTML_N_DD 148
/* pseudo tag */
#define HTML_SELECT_INT 160
diff --git a/tagtable.tab b/tagtable.tab
index cc94942..774fde9 100644
--- a/tagtable.tab
+++ b/tagtable.tab
@@ -203,6 +203,8 @@ select_int HTML_SELECT_INT
option_int HTML_OPTION_INT
section HTML_SECTION
/section HTML_N_SECTION
+/dt HTML_N_DT
+/dd HTML_N_DD
textarea_int HTML_TEXTAREA_INT
/textarea_int HTML_N_TEXTAREA_INT
pre_plain HTML_PRE_PLAIN