aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_validate.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2020-04-02 15:04:36 +0000
committerIngo Schwarze <schwarze@openbsd.org>2020-04-02 15:04:36 +0000
commit735c1e543343b638b339077b91a5874260cdf14b (patch)
tree930eb455cb29acfe6b5a98c93a46c9c4525d7bc6 /mdoc_validate.c
parentbc6d8c884c63e49aafa7894399d3d7060108b4ec (diff)
downloadmandoc-735c1e543343b638b339077b91a5874260cdf14b.tar.gz
mandoc-735c1e543343b638b339077b91a5874260cdf14b.tar.zst
mandoc-735c1e543343b638b339077b91a5874260cdf14b.zip
Copy tagged strings before marking hyphens as breakable.
For example, this makes ":tCo-processes" work in ksh(1).
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r--mdoc_validate.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c
index ad096588..551dec25 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -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 <schwarze@openbsd.org>
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -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;
+ }
}
}