Improve description list rendering

This commit is contained in:
bptato
2021-02-13 16:51:48 +01:00
parent 1cd0eb5c20
commit b2081866fd
4 changed files with 28 additions and 9 deletions
+22 -8
View File
@@ -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);
+2 -1
View File
@@ -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 */
+2
View File
@@ -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
+2
View File
@@ -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