diff options
Diffstat (limited to '')
-rw-r--r-- | file.c | 41 | ||||
-rw-r--r-- | html.c | 4 | ||||
-rw-r--r-- | html.h | 2 | ||||
-rw-r--r-- | tagtable.tab | 2 | ||||
-rw-r--r-- | tests/dl.expected | 37 | ||||
-rw-r--r-- | tests/dl.html | 56 |
6 files changed, 136 insertions, 6 deletions
@@ -4399,6 +4399,14 @@ process_idattr(struct readbuffer *obuf, int cmd, struct parsed_tag *tag) envs[h_env->envc].indent = envs[h_env->envc - 1].indent; \ } +#define PUSH_ENV_NOINDENT(cmd) \ + if (++h_env->envc_real < h_env->nenv) { \ + ++h_env->envc; \ + envs[h_env->envc].env = cmd; \ + envs[h_env->envc].count = 0; \ + envs[h_env->envc].indent = envs[h_env->envc - 1].indent; \ + } + #define POP_ENV \ if (h_env->envc_real-- < h_env->nenv) \ h_env->envc--; @@ -4645,7 +4653,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) h_env->limit); POP_ENV; if (!(obuf->flag & RB_PREMODE) && - (h_env->envc == 0 || cmd == HTML_N_DL || cmd == HTML_N_BLQ)) { + (h_env->envc == 0 || cmd == HTML_N_BLQ)) { do_blankline(h_env, obuf, envs[h_env->envc].indent, INDENT_INCR, h_env->limit); @@ -4658,11 +4666,13 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) 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)) + if (!(obuf->flag & RB_PREMODE) && envs[h_env->envc].env != HTML_DL + && envs[h_env->envc].env != HTML_DL_COMPACT + && envs[h_env->envc].env != HTML_DD) do_blankline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit); } - PUSH_ENV(cmd); + PUSH_ENV_NOINDENT(cmd); if (parsedtag_exists(tag, ATTR_COMPACT)) envs[h_env->envc].env = HTML_DL_COMPACT; obuf->flag |= RB_IGNORE_P; @@ -4758,7 +4768,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) (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); + PUSH_ENV_NOINDENT(HTML_DL); } if (h_env->envc > 0) { flushline(h_env, obuf, @@ -4770,6 +4780,16 @@ 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); + if (h_env->envc > 0 && envs[h_env->envc].env == HTML_DL) + flushline(h_env, obuf, + envs[h_env->envc - 1].indent, 0, h_env->limit); + return 1; case HTML_DD: CLOSE_A; CLOSE_DT; @@ -4779,6 +4799,10 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) envs[h_env->envc].env != HTML_DL_COMPACT)) { PUSH_ENV(HTML_DL); } + + if (h_env->envc <= MAX_INDENT_LEVEL) + envs[h_env->envc].indent = envs[h_env->envc - 1].indent + INDENT_INCR; + if (envs[h_env->envc].env == HTML_DL_COMPACT) { if (obuf->pos > envs[h_env->envc].indent) flushline(h_env, obuf, envs[h_env->envc].indent, 0, @@ -4790,6 +4814,15 @@ 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 || + (h_env->envc_real < h_env->nenv && + envs[h_env->envc].env != HTML_DL && + envs[h_env->envc].env != HTML_DL_COMPACT)) + return 1; + envs[h_env->envc].indent = envs[h_env->envc].indent - INDENT_INCR; + 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,9 +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}, /* 148 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 */ {NULL, NULL, 0, 0}, /* 151 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 diff --git a/tests/dl.expected b/tests/dl.expected new file mode 100644 index 0000000..b7af148 --- /dev/null +++ b/tests/dl.expected @@ -0,0 +1,37 @@ +w3m +WWW wo miru + A pager with web browsing capabilities, + maintained for Debian. + +Firefox +(linebreak) +FF A free, open source, cross-platform, + graphical web browser developed by the + Mozilla Corporation and hundreds of + volunteers. + The Red Panda also known as the Lesser + Panda, Wah, Bear Cat or Firefox, is a + mostly herbivorous mammal, slightly larger + than a domestic cat (60 cm long). + +Non-compact dl +w3m +WWW wo miru + A pager with web browsing capabilities, + maintained for Debian. + +Firefox +(linebreak) + +FF + A free, open source, cross-platform, + graphical web browser developed by the + Mozilla Corporation and hundreds of + volunteers. + nested + com item + The Red Panda also known as the Lesser + Panda, Wah, Bear Cat or Firefox, is a + mostly herbivorous mammal, slightly larger + than a domestic cat (60 cm long). + diff --git a/tests/dl.html b/tests/dl.html new file mode 100644 index 0000000..618eef4 --- /dev/null +++ b/tests/dl.html @@ -0,0 +1,56 @@ +<dl compact> + <dt>w3m</dt> + <dt>WWW wo miru</dt> + <dd> + A pager with web browsing capabilities,<br> + maintained for Debian. + </dd> + <dt><br>Firefox<br>(linebreak)</dt><br> + <dt>FF</dt> + <dd> + A free, open source, cross-platform,<br> + graphical web browser developed by the<br> + Mozilla Corporation and hundreds of<br> + volunteers. + </dd> + <dd> + The Red Panda also known as the Lesser<br> + Panda, Wah, Bear Cat or Firefox, is a<br> + mostly herbivorous mammal, slightly larger<br> + than a domestic cat (60 cm long). + </dd> +</dl> +<dl> + Non-compact dl + <dt>w3m</dt> + <dt>WWW wo miru</dt> + <dd> + A pager with web browsing capabilities,<br> + maintained for Debian. + </dd> + <dt><br>Firefox<br>(linebreak)</dt><br> + <dt>FF</dt> + <dd> + A free, open source, cross-platform,<br> + graphical web browser developed by the<br> + Mozilla Corporation and hundreds of<br> + volunteers. + <dl> + <dt>nested</dt> + <dd> + <dl compact> + <dt>com</dt> + <dd> + item + </dd> + </dl> + </dd> + </dl> + </dd> + <dd> + The Red Panda also known as the Lesser<br> + Panda, Wah, Bear Cat or Firefox, is a<br> + mostly herbivorous mammal, slightly larger<br> + than a domestic cat (60 cm long). + </dd> +</dl> |