diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-06-29 15:22:17 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-06-29 15:22:17 +0000 |
commit | 16ab65c3e3a699cbb2591d1d913f77b9ee7e25ef (patch) | |
tree | 6f1418434fcac4f2d96c367c6d84443f2d226ed5 /mdoc_validate.c | |
parent | 6ada7b83e842fe7b40ac2db5443c847045455474 (diff) | |
download | mandoc-16ab65c3e3a699cbb2591d1d913f77b9ee7e25ef.tar.gz |
warn about some non-portable idioms in .Bl -column;
triggered by a question from Yuri Pankov (illumos)
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r-- | mdoc_validate.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c index 5be54f6b..ceaaed7d 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1460,15 +1460,30 @@ post_it(POST_ARGS) assert(nit->head->child == NULL); - i = 0; - for (nch = nit->child; nch != NULL; nch = nch->next) - if (nch->type == ROFFT_BODY) - i++; + if (nit->head->next->child == NULL && + nit->head->next->next == NULL) { + mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse, + nit->line, nit->pos, "It"); + roff_node_delete(mdoc, nit); + break; + } + i = 0; + for (nch = nit->child; nch != NULL; nch = nch->next) { + if (nch->type != ROFFT_BODY) + continue; + if (i++ && nch->flags & NODE_LINE) + mandoc_msg(MANDOCERR_TA_LINE, mdoc->parse, + nch->line, nch->pos, "Ta"); + } if (i < cols || i > cols + 1) mandoc_vmsg(MANDOCERR_BL_COL, mdoc->parse, nit->line, nit->pos, "%d columns, %d cells", cols, i); + else if (nit->head->next->child != NULL && + nit->head->next->child->line > nit->line) + mandoc_msg(MANDOCERR_IT_NOARG, mdoc->parse, + nit->line, nit->pos, "Bl -column It"); break; default: abort(); |