=================================================================== RCS file: /cvs/mandoc/mdoc_validate.c,v retrieving revision 1.382 retrieving revision 1.383 diff -u -p -r1.382 -r1.383 --- mandoc/mdoc_validate.c 2020/04/02 15:04:36 1.382 +++ mandoc/mdoc_validate.c 2020/04/06 10:16:17 1.383 @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.382 2020/04/02 15:04:36 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.383 2020/04/06 10:16:17 schwarze Exp $ */ /* * Copyright (c) 2010-2020 Ingo Schwarze * Copyright (c) 2008-2012 Kristaps Dzonsons @@ -1105,6 +1105,7 @@ post_tg(POST_ARGS) struct roff_node *n; /* The .Tg node. */ struct roff_node *nch; /* The first child of the .Tg node. */ struct roff_node *nn; /* The next node after the .Tg node. */ + struct roff_node *np; /* The parent of the next node. */ struct roff_node *nt; /* The TEXT node containing the tag. */ size_t len; /* The number of bytes in the tag. */ @@ -1150,7 +1151,7 @@ post_tg(POST_ARGS) } /* By default, tag the .Tg node itself. */ - if (nn == NULL) + if (nn == NULL || nn->flags & NODE_ID) nn = n; /* Explicit tagging of specific macros. */ @@ -1158,8 +1159,41 @@ post_tg(POST_ARGS) case MDOC_Sh: case MDOC_Ss: case MDOC_Fo: - nn = nn->head; - /* FALLTHROUGH */ + nn = nn->head->child == NULL ? n : nn->head; + break; + case MDOC_It: + np = nn->parent; + while (np->tok != MDOC_Bl) + np = np->parent; + switch (np->norm->Bl.type) { + case LIST_column: + break; + case LIST_diag: + case LIST_hang: + case LIST_inset: + case LIST_ohang: + case LIST_tag: + nn = nn->head; + break; + case LIST_bullet: + case LIST_dash: + case LIST_enum: + case LIST_hyphen: + case LIST_item: + nn = nn->body->child == NULL ? n : nn->body; + break; + default: + abort(); + } + break; + case MDOC_Bd: + case MDOC_Bl: + case MDOC_D1: + case MDOC_Dl: + nn = nn->body->child == NULL ? n : nn->body; + break; + case MDOC_Pp: + break; case MDOC_Cm: case MDOC_Dv: case MDOC_Em: @@ -1172,9 +1206,9 @@ post_tg(POST_ARGS) case MDOC_Ms: case MDOC_No: case MDOC_Sy: - if (nn->child != NULL && (nn->flags & NODE_ID) == 0) - break; - /* FALLTHROUGH */ + if (nn->child == NULL) + nn = n; + break; default: nn = n; break;