diff options
author | bptato <nincsnevem662@gmail.com> | 2021-02-13 17:02:26 +0000 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2021-02-13 17:02:26 +0000 |
commit | 116e10749c42b4e073239c71fc44a4eaedd9c042 (patch) | |
tree | 0dd6960f90aeb1c973cedca6bc5390880590fcbd | |
parent | Fix <dl compact> (diff) | |
download | w3m-116e10749c42b4e073239c71fc44a4eaedd9c042.tar.gz w3m-116e10749c42b4e073239c71fc44a4eaedd9c042.zip |
Nested <dl>s
-rw-r--r-- | file.c | 13 | ||||
-rw-r--r-- | tests/dl.expected | 2 | ||||
-rw-r--r-- | tests/dl.html | 11 |
3 files changed, 21 insertions, 5 deletions
@@ -4404,6 +4404,7 @@ process_idattr(struct readbuffer *obuf, int cmd, struct parsed_tag *tag) ++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 \ @@ -4652,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); @@ -4665,7 +4666,9 @@ 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); } @@ -4796,10 +4799,9 @@ 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; - else - envs[h_env->envc].indent = envs[h_env->envc - 1].indent; if (envs[h_env->envc].env == HTML_DL_COMPACT) { if (obuf->pos > envs[h_env->envc].indent) @@ -4818,7 +4820,8 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env) 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 - 1].indent - INDENT_INCR; + 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); diff --git a/tests/dl.expected b/tests/dl.expected index 4e828ea..b7af148 100644 --- a/tests/dl.expected +++ b/tests/dl.expected @@ -28,6 +28,8 @@ FF 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 diff --git a/tests/dl.html b/tests/dl.html index 4824a8a..618eef4 100644 --- a/tests/dl.html +++ b/tests/dl.html @@ -35,6 +35,17 @@ 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> |