summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/man_html.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2011-01-16 03:46:21 +0000
committerschwarze <schwarze@openbsd.org>2011-01-16 03:46:21 +0000
commit39fa4f70a86aa2e1d1d2222d66dc3b3bca639324 (patch)
tree3af0f8f5c23b070ec557916d437a1371a1b58348 /usr.bin/mandoc/man_html.c
parentIf the first character of a free-form text input line is whitespace, (diff)
downloadwireguard-openbsd-39fa4f70a86aa2e1d1d2222d66dc3b3bca639324.tar.xz
wireguard-openbsd-39fa4f70a86aa2e1d1d2222d66dc3b3bca639324.zip
In literal context, do not generate output line breaks between macro
arguments. This fixes a long-standing bug reported repeatedly, in particular by naddy@ and brad@. Fix by kristaps@, minus one regression caught by my test suite.
Diffstat (limited to 'usr.bin/mandoc/man_html.c')
-rw-r--r--usr.bin/mandoc/man_html.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c
index 78d2da75f6e..2f7d14cc16a 100644
--- a/usr.bin/mandoc/man_html.c
+++ b/usr.bin/mandoc/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.31 2011/01/16 02:56:47 schwarze Exp $ */
+/* $Id: man_html.c,v 1.32 2011/01/16 03:46:21 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -182,12 +182,6 @@ print_man_node(MAN_ARGS)
bufinit(h);
- /*
- * FIXME: embedded elements within next-line scopes (e.g., `br'
- * within an empty `B') will cause formatting to be forgotten
- * due to scope closing out.
- */
-
switch (n->type) {
case (MAN_ROOT):
child = man_root_pre(m, n, mh, h);
@@ -196,19 +190,19 @@ print_man_node(MAN_ARGS)
if ('\0' == *n->string) {
print_otag(h, TAG_P, 0, NULL);
return;
- }
-
- if (' ' == *n->string && MAN_LINE & n->flags)
+ } else if (' ' == *n->string && MAN_LINE & n->flags)
print_otag(h, TAG_BR, 0, NULL);
print_text(h, n->string);
- if (MANH_LITERAL & mh->fl)
+ if (MANH_LITERAL & mh->fl &&
+ (NULL == n->next ||
+ n->next->line > n->line))
print_otag(h, TAG_BR, 0, NULL);
return;
case (MAN_TBL):
print_tbl(h, n->span);
- break;
+ return;
default:
/*
* Close out scope of font prior to opening a macro
@@ -236,8 +230,6 @@ print_man_node(MAN_ARGS)
case (MAN_ROOT):
man_root_post(m, n, mh, h);
break;
- case (MAN_TBL):
- break;
default:
if (mans[n->tok].post)
(*mans[n->tok].post)(m, n, mh, h);