- if (MAN_BODY == n->type)
- switch (n->tok) {
- case (MAN_IP):
- /* FALLTHROUGH */
- case (MAN_HP):
- /* FALLTHROUGH */
- case (MAN_TP):
- /* Body-less lists are ok. */
- break;
- default:
- if (n->nchild)
- break;
- return(man_nwarn(m, n, WBODYARGS));
- }
- if (MAN_HEAD == n->type)
- switch (n->tok) {
- case (MAN_PP):
- /* FALLTHROUGH */
- case (MAN_P):
- /* FALLTHROUGH */
- case (MAN_LP):
- if (0 == n->nchild)
- break;
- return(man_nwarn(m, n, WNHEADARGS));
- default:
- if (n->nchild)
+ switch (n->type) {
+ case MAN_BLOCK:
+ if (0 == n->body->nchild)
+ man_node_delete(man, n);
+ break;
+ case MAN_BODY:
+ if (0 == n->nchild)
+ mandoc_vmsg(MANDOCERR_PAR_SKIP,
+ man->parse, n->line, n->pos,
+ "%s empty", man_macronames[n->tok]);
+ break;
+ case MAN_HEAD:
+ if (n->nchild)
+ man_nmsg(man, n, MANDOCERR_ARGSLOST);
+ break;
+ default:
+ break;
+ }
+
+ 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(man, n);
+ break;
+ case MAN_BODY:
+ if (0 == n->parent->head->nchild && 0 == n->nchild)
+ mandoc_vmsg(MANDOCERR_PAR_SKIP,
+ man->parse, n->line, n->pos,
+ "%s empty", man_macronames[n->tok]);
+ break;
+ default:
+ break;
+ }
+ return(1);
+}
+
+static int
+post_TH(CHKARGS)
+{
+ struct man_node *nb;
+ const char *p;
+
+ free(man->meta.title);
+ free(man->meta.vol);
+ free(man->meta.source);
+ free(man->meta.msec);
+ free(man->meta.date);
+
+ man->meta.title = man->meta.vol = man->meta.date =
+ man->meta.msec = man->meta.source = NULL;
+
+ nb = n;
+
+ /* ->TITLE<- MSEC DATE SOURCE VOL */
+
+ n = n->child;
+ if (n && n->string) {
+ for (p = n->string; '\0' != *p; p++) {
+ /* Only warn about this once... */
+ if (isalpha((unsigned char)*p) &&
+ ! isupper((unsigned char)*p)) {
+ mandoc_msg(MANDOCERR_TITLE_CASE,
+ man->parse, n->line,
+ n->pos + (p - n->string),
+ n->string);