diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2012-07-18 11:11:12 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2012-07-18 11:11:12 +0000 |
commit | 1c57e34fd38554f0651309503b2141e84b7db486 (patch) | |
tree | 184c95fd172a2cef1ec723317fb102ed3b1188d4 /mdoc_validate.c | |
parent | 2b1a4d195c217fdbdc7ef44fc5082a40d73cdf1a (diff) | |
download | mandoc-1c57e34fd38554f0651309503b2141e84b7db486.tar.gz |
Fix handling of paragraph macros inside lists:
* When they are trailing the last item, move them outside the list.
* When they are trailing any other none-compact item, drop them.
OpenBSD rev. mdoc_validate.c 1.107, mdoc.c 1.91
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r-- | mdoc_validate.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c index 7f2a991e..8dcd19f8 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1353,7 +1353,7 @@ post_it(POST_ARGS) static int post_bl_block(POST_ARGS) { - struct mdoc_node *n; + struct mdoc_node *n, *ni, *nc; /* * These are fairly complicated, so we've broken them into two @@ -1369,13 +1369,42 @@ post_bl_block(POST_ARGS) NULL == n->norm->Bl.width) { if ( ! post_bl_block_tag(mdoc)) return(0); + assert(n->norm->Bl.width); } else if (NULL != n->norm->Bl.width) { if ( ! post_bl_block_width(mdoc)) return(0); - } else - return(1); + assert(n->norm->Bl.width); + } - assert(n->norm->Bl.width); + for (ni = n->body->child; ni; ni = ni->next) { + if (NULL == ni->body) + continue; + nc = ni->body->last; + while (NULL != nc) { + switch (nc->tok) { + case (MDOC_Pp): + /* FALLTHROUGH */ + case (MDOC_Lp): + /* FALLTHROUGH */ + case (MDOC_br): + break; + default: + nc = NULL; + continue; + } + if (NULL == ni->next) { + mdoc_nmsg(mdoc, nc, MANDOCERR_MOVEPAR); + if ( ! mdoc_node_relink(mdoc, nc)) + return(0); + } else if (0 == n->norm->Bl.comp && + LIST_column != n->norm->Bl.type) { + mdoc_nmsg(mdoc, nc, MANDOCERR_IGNPAR); + mdoc_node_delete(mdoc, nc); + } else + break; + nc = ni->body->last; + } + } return(1); } |