=================================================================== RCS file: /cvs/mandoc/mdoc_html.c,v retrieving revision 1.339 retrieving revision 1.342 diff -u -p -r1.339 -r1.342 --- mandoc/mdoc_html.c 2020/04/18 20:40:10 1.339 +++ mandoc/mdoc_html.c 2021/03/30 19:26:20 1.342 @@ -1,6 +1,6 @@ -/* $Id: mdoc_html.c,v 1.339 2020/04/18 20:40:10 schwarze Exp $ */ +/* $Id: mdoc_html.c,v 1.342 2021/03/30 19:26:20 schwarze Exp $ */ /* - * Copyright (c) 2014-2020 Ingo Schwarze + * Copyright (c) 2014-2021 Ingo Schwarze * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any @@ -349,12 +349,11 @@ print_mdoc_node(MDOC_ARGS) if (n->type == ROFFT_COMMENT || n->flags & NODE_NOPRT) return; - if (n->flags & NODE_NOFILL) { - html_fillmode(h, ROFF_nf); - if (n->flags & NODE_LINE) - print_endline(h); - } else + if ((n->flags & NODE_NOFILL) == 0) html_fillmode(h, ROFF_fi); + else if (html_fillmode(h, ROFF_nf) == ROFF_nf && + n->tok != ROFF_fi && n->flags & NODE_LINE) + print_endline(h); child = 1; n->flags &= ~NODE_ENDED; @@ -695,8 +694,10 @@ mdoc_tg_pre(MDOC_ARGS) { char *id; - if ((id = html_make_id(n, 1)) != NULL) + if ((id = html_make_id(n, 1)) != NULL) { print_tagq(h, print_otag(h, TAG_MARK, "i", id)); + free(id); + } return 0; } @@ -929,7 +930,7 @@ mdoc_sx_pre(MDOC_ARGS) static int mdoc_bd_pre(MDOC_ARGS) { - char buf[16]; + char buf[20]; struct roff_node *nn; int comp; @@ -966,6 +967,9 @@ mdoc_bd_pre(MDOC_ARGS) strcmp(n->norm->Bd.offs, "left") != 0) (void)strlcat(buf, " Bd-indent", sizeof(buf)); + if (n->norm->Bd.type == DISP_literal) + (void)strlcat(buf, " Li", sizeof(buf)); + print_otag_id(h, TAG_DIV, buf, n); return 1; } @@ -1211,6 +1215,8 @@ mdoc_skip_pre(MDOC_ARGS) static int mdoc_pp_pre(MDOC_ARGS) { + char *id; + if (n->flags & NODE_NOFILL) { print_endline(h); if (n->flags & NODE_ID) @@ -1221,8 +1227,9 @@ mdoc_pp_pre(MDOC_ARGS) } } else { html_close_paragraph(h); - print_otag(h, TAG_P, "ci", "Pp", - n->flags & NODE_ID ? html_make_id(n, 1) : NULL); + id = n->flags & NODE_ID ? html_make_id(n, 1) : NULL; + print_otag(h, TAG_P, "ci", "Pp", id); + free(id); } return 0; }