summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/man.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2013-11-10 22:53:58 +0000
committerschwarze <schwarze@openbsd.org>2013-11-10 22:53:58 +0000
commiteca45ce07d1abdde3ab148fab82b94aac7f84772 (patch)
tree67580ce1f0d20bafbdc151da3ecb687f2068079b /usr.bin/mandoc/man.c
parentSupport the alternative syntax \C'uXXXX' for Unicode characters. (diff)
downloadwireguard-openbsd-eca45ce07d1abdde3ab148fab82b94aac7f84772.tar.xz
wireguard-openbsd-eca45ce07d1abdde3ab148fab82b94aac7f84772.zip
Ignore blank lines right after .SH and .SS.
Improves the rendering of gpg(1); issue reported by jca on ports.
Diffstat (limited to 'usr.bin/mandoc/man.c')
-rw-r--r--usr.bin/mandoc/man.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c
index 909019f85f1..f23577d6082 100644
--- a/usr.bin/mandoc/man.c
+++ b/usr.bin/mandoc/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.70 2013/10/17 20:51:28 schwarze Exp $ */
+/* $Id: man.c,v 1.71 2013/11/10 22:53:58 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -425,16 +425,22 @@ man_ptext(struct man *man, int line, char *buf, int offs)
return(man_descope(man, line, offs));
}
- /* Pump blank lines directly into the backend. */
-
for (i = offs; ' ' == buf[i]; i++)
/* Skip leading whitespace. */ ;
+ /*
+ * Blank lines are ignored right after headings
+ * but add a single vertical space elsewhere.
+ */
+
if ('\0' == buf[i]) {
/* Allocate a blank entry. */
- if ( ! man_elem_alloc(man, line, offs, MAN_sp))
- return(0);
- man->next = MAN_NEXT_SIBLING;
+ if (MAN_SH != man->last->tok &&
+ MAN_SS != man->last->tok) {
+ if ( ! man_elem_alloc(man, line, offs, MAN_sp))
+ return(0);
+ man->next = MAN_NEXT_SIBLING;
+ }
return(1);
}