aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_man.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-05-30 16:31:29 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-05-30 16:31:29 +0000
commitb85deb01cef03da6ed5386c5a24881bbba2216b2 (patch)
treea2f50414c87131ab5b6592957a8e8f665f938e52 /mdoc_man.c
parenta20be95dec7797c55257792a32b6b39bdbdfe595 (diff)
downloadmandoc-b85deb01cef03da6ed5386c5a24881bbba2216b2.tar.gz
mandoc-b85deb01cef03da6ed5386c5a24881bbba2216b2.tar.zst
mandoc-b85deb01cef03da6ed5386c5a24881bbba2216b2.zip
fix formatting of intermediate punctuation in .Lk
Diffstat (limited to 'mdoc_man.c')
-rw-r--r--mdoc_man.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/mdoc_man.c b/mdoc_man.c
index 4b792524..f2ccdd0f 100644
--- a/mdoc_man.c
+++ b/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_man.c,v 1.115 2017/05/08 15:34:54 schwarze Exp $ */
+/* $Id: mdoc_man.c,v 1.116 2017/05/30 16:31:29 schwarze Exp $ */
/*
* Copyright (c) 2011-2017 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -1527,16 +1527,22 @@ post_lb(DECL_ARGS)
static int
pre_lk(DECL_ARGS)
{
- const struct roff_node *link, *descr;
+ const struct roff_node *link, *descr, *punct;
int display;
if ((link = n->child) == NULL)
return 0;
+ /* Find beginning of trailing punctuation. */
+ punct = n->last;
+ while (punct != link && punct->flags & NODE_DELIMC)
+ punct = punct->prev;
+ punct = punct->next;
+
/* Link text. */
- if ((descr = link->next) != NULL && !(descr->flags & NODE_DELIMC)) {
+ if ((descr = link->next) != NULL && descr != punct) {
font_push('I');
- while (descr != NULL && !(descr->flags & NODE_DELIMC)) {
+ while (descr != punct) {
print_word(descr->string);
descr = descr->next;
}
@@ -1556,9 +1562,9 @@ pre_lk(DECL_ARGS)
font_pop();
/* Trailing punctuation. */
- while (descr != NULL) {
- print_word(descr->string);
- descr = descr->next;
+ while (punct != NULL) {
+ print_word(punct->string);
+ punct = punct->next;
}
if (display)
print_line(".RE", MMAN_nl);