diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-02-26 12:42:30 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-02-26 12:42:30 +0000 |
commit | dcfdceaac423336925dcee2964a192807bfce5f5 (patch) | |
tree | 0390477b4f74ac4ea72dbcffbfdd68e55435f3df | |
parent | edd55148017e5ed1479d7bc9d62502478202b158 (diff) |
The groff_man(7) manual says "the first line of text following" .TP is
used as a label, not "the first line following", so allow (some kinds of)
intervening macros - some people actually put macros in between.
On the other hand, when there is no text line before the next block macro,
that is, when the .TP block ends without any text line, then something *is*
broken, so still error out in that case.
-rw-r--r-- | usr.bin/mandoc/man.c | 5 | ||||
-rw-r--r-- | usr.bin/mandoc/man_term.c | 9 | ||||
-rw-r--r-- | usr.bin/mandoc/man_validate.c | 8 |
3 files changed, 13 insertions, 9 deletions
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c index d9a88f7b648..daea772af0c 100644 --- a/usr.bin/mandoc/man.c +++ b/usr.bin/mandoc/man.c @@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.18 2010/02/18 02:11:26 schwarze Exp $ */ +/* $Id: man.c,v 1.19 2010/02/26 12:42:29 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -564,7 +564,8 @@ man_pmacro(struct man *m, int ln, char *buf) goto err; out: - if ( ! (MAN_BLINE & fl)) + if ( ! (MAN_BLINE & fl) || (MAN_TEXT != m->last->type && + (NULL == m->last->child || MAN_TEXT != m->last->child->type))) return(1); /* diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index 50f175e752c..87c1c7bb723 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.21 2009/12/24 02:08:14 schwarze Exp $ */ +/* $Id: man_term.c,v 1.22 2010/02/26 12:42:29 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -570,10 +570,13 @@ pre_TP(DECL_ARGS) /* Calculate offset. */ - if (NULL != (nn = n->parent->head->child)) - if (NULL != nn->next) + if (NULL != (nn = n->parent->head->child)) { + while (nn && MAN_TEXT != nn->type) + nn = nn->next; + if (nn && nn->next) if ((ival = a2width(nn)) >= 0) len = (size_t)ival; + } switch (n->type) { case (MAN_HEAD): diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c index e6151cc8343..64e49bf1f07 100644 --- a/usr.bin/mandoc/man_validate.c +++ b/usr.bin/mandoc/man_validate.c @@ -1,4 +1,4 @@ -/* $Id: man_validate.c,v 1.11 2009/10/27 21:40:07 schwarze Exp $ */ +/* $Id: man_validate.c,v 1.12 2010/02/26 12:42:29 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -55,7 +55,7 @@ static v_check posts_sp[] = { check_le1, NULL }; static v_check pres_bline[] = { check_bline, NULL }; static const struct man_valid man_valids[MAN_MAX] = { - { pres_bline, posts_eq0 }, /* br */ + { NULL, posts_eq0 }, /* br */ { pres_bline, posts_ge2_le5 }, /* TH */ { pres_bline, posts_sec }, /* SH */ { pres_bline, posts_sec }, /* SS */ @@ -76,9 +76,9 @@ static const struct man_valid man_valids[MAN_MAX] = { { NULL, NULL }, /* I */ { NULL, NULL }, /* IR */ { NULL, NULL }, /* RI */ - { pres_bline, posts_eq0 }, /* na */ + { NULL, posts_eq0 }, /* na */ { NULL, NULL }, /* i */ - { pres_bline, posts_sp }, /* sp */ + { NULL, posts_sp }, /* sp */ { pres_bline, posts_eq0 }, /* nf */ { pres_bline, posts_eq0 }, /* fi */ { NULL, NULL }, /* r */ |