summaryrefslogtreecommitdiffstats
path: root/mdoc_validate.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c37
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);
}