diff options
author | bptato <nincsnevem662@gmail.com> | 2021-02-13 15:51:48 +0000 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2021-02-13 15:51:48 +0000 |
commit | b2081866fd6d5e03cc672d7f0c71e35446a07747 (patch) | |
tree | e9d82be0d0bda48b382b87c5d5e48a1ceecfffba | |
parent | Update ChangeLog (diff) | |
download | w3m-b2081866fd6d5e03cc672d7f0c71e35446a07747.tar.gz w3m-b2081866fd6d5e03cc672d7f0c71e35446a07747.zip |
Improve description list rendering
Diffstat (limited to '')
-rw-r--r-- | file.c | 30 | ||||
-rw-r--r-- | html.c | 3 | ||||
-rw-r--r-- | html.h | 2 | ||||
-rw-r--r-- | tagtable.tab | 2 |
4 files changed, 28 insertions, 9 deletions
@@ -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); @@ -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 */ @@ -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 |