summaryrefslogtreecommitdiffstats
path: root/man.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2013-11-10 22:54:40 +0000
committerIngo Schwarze <schwarze@openbsd.org>2013-11-10 22:54:40 +0000
commitb62bcd63e382e3538d704cd43ecca19bbf9c568b (patch)
tree3b4608c27a1122002de3c81428891d5650093b9f /man.c
parent686b4d965f981326a795a8476888351e5cfe3ae9 (diff)
downloadmandoc-b62bcd63e382e3538d704cd43ecca19bbf9c568b.tar.gz
Ignore blank lines right after .SH and .SS.
Improves the rendering of gpg(1); issue reported by jca on ports.
Diffstat (limited to 'man.c')
-rw-r--r--man.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/man.c b/man.c
index 2e9549fb..896a19ce 100644
--- a/man.c
+++ b/man.c
@@ -429,16 +429,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);
}