diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2019-01-05 21:52:58 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2019-01-05 21:52:58 +0000 |
commit | 0ba6418eac54e81e7593d7d39dd9e598522c6e8a (patch) | |
tree | 0f9b42b32e0661cd83ed288999cd99267f612b31 | |
parent | 89a9537c162b30f23d3866ff69bbe1e9f0295467 (diff) |
In no-fill mode, avoid bogus blank lines in two situations:
1. After the last child; the parent will take care of the line break.
2. At the .YS macro; the end of the preceding .SY already broke the line.
-rw-r--r-- | regress/usr.bin/mandoc/man/SY/Makefile | 3 | ||||
-rw-r--r-- | regress/usr.bin/mandoc/man/SY/literal.out_html | 31 | ||||
-rw-r--r-- | usr.bin/mandoc/man_html.c | 6 |
3 files changed, 36 insertions, 4 deletions
diff --git a/regress/usr.bin/mandoc/man/SY/Makefile b/regress/usr.bin/mandoc/man/SY/Makefile index 54045804f02..9896d9d155e 100644 --- a/regress/usr.bin/mandoc/man/SY/Makefile +++ b/regress/usr.bin/mandoc/man/SY/Makefile @@ -1,5 +1,6 @@ -# $OpenBSD: Makefile,v 1.1 2019/01/05 21:13:55 schwarze Exp $ +# $OpenBSD: Makefile,v 1.2 2019/01/05 21:52:57 schwarze Exp $ REGRESS_TARGETS = literal +HTML_TARGETS = literal .include <bsd.regress.mk> diff --git a/regress/usr.bin/mandoc/man/SY/literal.out_html b/regress/usr.bin/mandoc/man/SY/literal.out_html new file mode 100644 index 00000000000..b1f378cf26d --- /dev/null +++ b/regress/usr.bin/mandoc/man/SY/literal.out_html @@ -0,0 +1,31 @@ +BEGINTEST +<br/> +initial regular text +<table class="Nm"> + <tr> + <td><code class="Nm" title="Nm">command</code></td> + <td><i>arguments</i></td> + </tr> +</table> +middle regular text +<pre> +literal text +before display +</pre> +<table class="Nm"> + <tr> + <td><code class="Nm" title="Nm">command</code></td> + <td> + <pre> +<i>arguments</i> + </pre> + </td> + </tr> +</table> +<pre> +literal text +after display +</pre> +final regular text +<br/> +ENDTEST diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c index ba1632c9c6c..d2bf1733fdf 100644 --- a/usr.bin/mandoc/man_html.c +++ b/usr.bin/mandoc/man_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_html.c,v 1.117 2019/01/05 09:46:26 schwarze Exp $ */ +/* $OpenBSD: man_html.c,v 1.118 2019/01/05 21:52:57 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013-2015, 2017-2019 Ingo Schwarze <schwarze@openbsd.org> @@ -254,8 +254,8 @@ print_man_node(MAN_ARGS) /* This will automatically close out any font scope. */ print_stagq(h, t); - if (n->flags & NODE_NOFILL && - (n->next == NULL || n->next->flags & NODE_LINE)) { + if (n->flags & NODE_NOFILL && n->tok != MAN_YS && + (n->next != NULL && n->next->flags & NODE_LINE)) { /* In .nf = <pre>, print even empty lines. */ h->col++; print_endline(h); |