=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc_validate.c,v retrieving revision 1.297 retrieving revision 1.298 diff -c -r1.297 -r1.298 *** src/usr.bin/mandoc/mdoc_validate.c 2020/04/02 14:55:29 1.297 --- src/usr.bin/mandoc/mdoc_validate.c 2020/04/06 09:55:49 1.298 *************** *** 1,4 **** ! /* $OpenBSD: mdoc_validate.c,v 1.297 2020/04/02 14:55:29 schwarze Exp $ */ /* * Copyright (c) 2010-2020 Ingo Schwarze * Copyright (c) 2008-2012 Kristaps Dzonsons --- 1,4 ---- ! /* $OpenBSD: mdoc_validate.c,v 1.298 2020/04/06 09:55:49 schwarze Exp $ */ /* * Copyright (c) 2010-2020 Ingo Schwarze * Copyright (c) 2008-2012 Kristaps Dzonsons *************** *** 1090,1095 **** --- 1090,1096 ---- 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. */ *************** *** 1135,1141 **** } /* By default, tag the .Tg node itself. */ ! if (nn == NULL) nn = n; /* Explicit tagging of specific macros. */ --- 1136,1142 ---- } /* By default, tag the .Tg node itself. */ ! if (nn == NULL || nn->flags & NODE_ID) nn = n; /* Explicit tagging of specific macros. */ *************** *** 1143,1150 **** case MDOC_Sh: case MDOC_Ss: case MDOC_Fo: ! nn = nn->head; ! /* FALLTHROUGH */ case MDOC_Cm: case MDOC_Dv: case MDOC_Em: --- 1144,1184 ---- case MDOC_Sh: case MDOC_Ss: case MDOC_Fo: ! 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: *************** *** 1157,1165 **** case MDOC_Ms: case MDOC_No: case MDOC_Sy: ! if (nn->child != NULL && (nn->flags & NODE_ID) == 0) ! break; ! /* FALLTHROUGH */ default: nn = n; break; --- 1191,1199 ---- case MDOC_Ms: case MDOC_No: case MDOC_Sy: ! if (nn->child == NULL) ! nn = n; ! break; default: nn = n; break;