diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2012-07-18 16:52:03 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2012-07-18 16:52:03 +0000 |
commit | 57839926b7f5afc693c79a347c6ffd83a56bb780 (patch) | |
tree | 425ea2a419a2d6c0a1f92f7b0b03988719f96597 /man_validate.c | |
parent | 3baee6b2cf08cfd97e8919f359b6754c2ddcd6bb (diff) | |
download | mandoc-57839926b7f5afc693c79a347c6ffd83a56bb780.tar.gz mandoc-57839926b7f5afc693c79a347c6ffd83a56bb780.tar.zst mandoc-57839926b7f5afc693c79a347c6ffd83a56bb780.zip |
Drop empty .IP such that is does not cause additional vertical spacing.
Issue first reported by naddy@ in rsync(1).
OpenBSD rev. 1.55.
Diffstat (limited to 'man_validate.c')
-rw-r--r-- | man_validate.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/man_validate.c b/man_validate.c index 38aa29f0..1b2a0e1d 100644 --- a/man_validate.c +++ b/man_validate.c @@ -1,4 +1,4 @@ -/* $Id: man_validate.c,v 1.82 2012/07/18 16:41:09 schwarze Exp $ */ +/* $Id: man_validate.c,v 1.83 2012/07/18 16:52:03 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012 Ingo Schwarze <schwarze@openbsd.org> @@ -55,6 +55,7 @@ static int check_root(CHKARGS); static void check_text(CHKARGS); static int post_AT(CHKARGS); +static int post_IP(CHKARGS); static int post_vs(CHKARGS); static int post_fi(CHKARGS); static int post_ft(CHKARGS); @@ -70,6 +71,7 @@ static v_check posts_eq0[] = { check_eq0, NULL }; static v_check posts_eq2[] = { check_eq2, NULL }; static v_check posts_fi[] = { check_eq0, post_fi, NULL }; static v_check posts_ft[] = { post_ft, NULL }; +static v_check posts_ip[] = { post_IP, NULL }; static v_check posts_nf[] = { check_eq0, post_nf, NULL }; static v_check posts_par[] = { check_par, NULL }; static v_check posts_part[] = { check_part, NULL }; @@ -88,7 +90,7 @@ static const struct man_valid man_valids[MAN_MAX] = { { NULL, posts_par }, /* LP */ { NULL, posts_par }, /* PP */ { NULL, posts_par }, /* P */ - { NULL, NULL }, /* IP */ + { NULL, posts_ip }, /* IP */ { NULL, NULL }, /* HP */ { NULL, NULL }, /* SM */ { NULL, NULL }, /* SB */ @@ -354,6 +356,24 @@ check_par(CHKARGS) return(1); } +static int +post_IP(CHKARGS) +{ + + switch (n->type) { + case (MAN_BLOCK): + if (0 == n->head->nchild && 0 == n->body->nchild) + man_node_delete(m, n); + break; + case (MAN_BODY): + if (0 == n->parent->head->nchild && 0 == n->nchild) + man_nmsg(m, n, MANDOCERR_IGNPAR); + break; + default: + break; + } + return(1); +} static int post_TH(CHKARGS) |