=================================================================== RCS file: /cvs/mandoc/mdoc_validate.c,v retrieving revision 1.381 retrieving revision 1.382 diff -u -p -r1.381 -r1.382 --- mandoc/mdoc_validate.c 2020/04/01 20:21:08 1.381 +++ mandoc/mdoc_validate.c 2020/04/02 15:04:36 1.382 @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.381 2020/04/01 20:21:08 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.382 2020/04/02 15:04:36 schwarze Exp $ */ /* * Copyright (c) 2010-2020 Ingo Schwarze * Copyright (c) 2008-2012 Kristaps Dzonsons @@ -2164,10 +2164,11 @@ post_rs(POST_ARGS) static void post_hyph(POST_ARGS) { - struct roff_node *nch; + struct roff_node *n, *nch; char *cp; - for (nch = mdoc->last->child; nch != NULL; nch = nch->next) { + n = mdoc->last; + for (nch = n->child; nch != NULL; nch = nch->next) { if (nch->type != ROFFT_TEXT) continue; cp = nch->string; @@ -2176,8 +2177,11 @@ post_hyph(POST_ARGS) while (*(++cp) != '\0') if (*cp == '-' && isalpha((unsigned char)cp[-1]) && - isalpha((unsigned char)cp[1])) + isalpha((unsigned char)cp[1])) { + if (n->string == NULL && n->flags & NODE_ID) + n->string = mandoc_strdup(nch->string); *cp = ASCII_HYPH; + } } }