summaryrefslogtreecommitdiffstats
path: root/man_html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2020-10-16 17:22:43 +0000
committerIngo Schwarze <schwarze@openbsd.org>2020-10-16 17:22:43 +0000
commite6ebe29e01dda236ae873eb8841f10bc6640c8d5 (patch)
treeafc871e929a8e1bccec831668c7997844336bf37 /man_html.c
parent8539c24bce93430b560ca288ae81e8c90993e54b (diff)
downloadmandoc-e6ebe29e01dda236ae873eb8841f10bc6640c8d5.tar.gz
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 'man_html.c')
-rw-r--r--man_html.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/man_html.c b/man_html.c
index 21a76517..5f715cf0 100644
--- a/man_html.c
+++ b/man_html.c
@@ -169,7 +169,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) {
@@ -253,13 +258,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