diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2013-11-10 22:54:40 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2013-11-10 22:54:40 +0000 |
commit | 7e66e0356807e7c8c64b707c229784ae9fdc0512 (patch) | |
tree | 9bd0bf057334bf80c8b8db9e1fe6b71231b08825 /man.c | |
parent | 5e0e65fbd25d66b3479bdd089f840bb078f27d13 (diff) | |
download | mandoc-7e66e0356807e7c8c64b707c229784ae9fdc0512.tar.gz mandoc-7e66e0356807e7c8c64b707c229784ae9fdc0512.tar.zst mandoc-7e66e0356807e7c8c64b707c229784ae9fdc0512.zip |
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.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.120 2013/10/17 20:54:58 schwarze Exp $ */ +/* $Id: man.c,v 1.121 2013/11/10 22:54:40 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -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); } |