summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/man_html.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2020-10-16 17:22:38 +0000
committerschwarze <schwarze@openbsd.org>2020-10-16 17:22:38 +0000
commit52e71e33c10fdbafd27b5747afc720bb78479475 (patch)
tree66f5c3a96ca2c24e76931ef2a51482bbb1a199f6 /usr.bin/mandoc/man_html.c
parentadd space between macro arg and punctuation; (diff)
downloadwireguard-openbsd-52e71e33c10fdbafd27b5747afc720bb78479475.tar.xz
wireguard-openbsd-52e71e33c10fdbafd27b5747afc720bb78479475.zip
In HTML output, avoid printing a newline right after <pre>
and right before </pre> because that resulted in vertical whitespace not requested by the manual page author. Formatting bug reported by Aman Verma <amanraoverma plus vim at gmail dot com> on discuss@.
Diffstat (limited to 'usr.bin/mandoc/man_html.c')
-rw-r--r--usr.bin/mandoc/man_html.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c
index a2a1b4d959c..3d57bad66c0 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.131 2020/04/04 20:23:06 schwarze Exp $ */
+/* $OpenBSD: man_html.c,v 1.132 2020/10/16 17:22:39 schwarze Exp $ */
/*
* Copyright (c) 2013-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -167,7 +167,12 @@ print_man_node(MAN_ARGS)
if (n->type == ROFFT_COMMENT || n->flags & NODE_NOPRT)
return;
- html_fillmode(h, n->flags & NODE_NOFILL ? ROFF_nf : ROFF_fi);
+ 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 &&
+ (n->prev == NULL || n->prev->tok != MAN_YS))
+ print_endline(h);
child = 1;
switch (n->type) {
@@ -251,13 +256,6 @@ print_man_node(MAN_ARGS)
}
if (t != NULL)
print_stagq(h, t);
-
- 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);
- }
}
static void