aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit7f36e58ef077e2bf3ff4592144b6be7ccc0db8de (patch)
tree6cfddb47fabc9a3aa09e66786d7c5bc244574cd4 /man_html.c
parent9f048bffaf55fe5d4982bd74026e6003754fe978 (diff)
downloadmandoc-7f36e58ef077e2bf3ff4592144b6be7ccc0db8de.tar.gz
mandoc-7f36e58ef077e2bf3ff4592144b6be7ccc0db8de.tar.zst
mandoc-7f36e58ef077e2bf3ff4592144b6be7ccc0db8de.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 'man_html.c')
-rw-r--r--man_html.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/man_html.c b/man_html.c
index 80f69e1a..147c20e4 100644
--- a/man_html.c
+++ b/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.178 2020/04/04 20:33:33 schwarze Exp $ */
+/* $Id: man_html.c,v 1.179 2020/10/16 17:22:43 schwarze Exp $ */
/*
* Copyright (c) 2013-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -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