.Sh DESCRIPTION
multiple arguments
.Lk http://www.bsd.lv/ the bsd.lv project ,
-.Lk http://www.gnu.org/software/groff/ GNU troff ,
+.Lk http://www.gnu.org/software/groff/ GNU troff ","
two arguments
.Lk http://mdocml.bsd.lv/ mandoc
one argument
-/* $OpenBSD: mdoc_html.c,v 1.163 2017/05/17 17:53:48 schwarze Exp $ */
+/* $OpenBSD: mdoc_html.c,v 1.164 2017/05/30 16:31:25 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
static int
mdoc_lk_pre(MDOC_ARGS)
{
+ const struct roff_node *link, *descr, *punct;
struct tag *t;
- if ((n = n->child) == NULL)
+ 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 target and link text. */
- t = print_otag(h, TAG_A, "cTh", "Lk", n->string);
- if (n->next == NULL || n->next->flags & NODE_DELIMC)
- print_text(h, n->string);
- for (n = n->next; n != NULL && !(n->flags & NODE_DELIMC); n = n->next)
- print_text(h, n->string);
+ t = print_otag(h, TAG_A, "cTh", "Lk", link->string);
+ for (descr = link->next; descr != punct; descr = descr->next) {
+ if (descr->flags & (NODE_DELIMC | NODE_DELIMO))
+ h->flags |= HTML_NOSPACE;
+ print_text(h, descr->string);
+ }
print_tagq(h, t);
/* Trailing punctuation. */
- while (n != NULL) {
+ while (punct != NULL) {
h->flags |= HTML_NOSPACE;
- print_text(h, n->string);
- n = n->next;
+ print_text(h, punct->string);
+ punct = punct->next;
}
return 0;
}
-/* $OpenBSD: mdoc_man.c,v 1.113 2017/05/08 15:33:43 schwarze Exp $ */
+/* $OpenBSD: mdoc_man.c,v 1.114 2017/05/30 16:31:25 schwarze Exp $ */
/*
* Copyright (c) 2011-2017 Ingo Schwarze <schwarze@openbsd.org>
*
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;
}
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);
-/* $OpenBSD: mdoc_markdown.c,v 1.21 2017/05/05 15:16:25 schwarze Exp $ */
+/* $OpenBSD: mdoc_markdown.c,v 1.22 2017/05/30 16:31:25 schwarze Exp $ */
/*
* Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
*
static int
md_pre_Lk(struct roff_node *n)
{
- const struct roff_node *link, *descr;
+ const struct roff_node *link, *descr, *punct;
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. */
descr = link->next;
- if (descr == NULL || descr->flags & NODE_DELIMC)
+ if (descr == punct)
descr = link; /* no text */
md_rawword("[");
outflags &= ~MD_spc;
do {
md_word(descr->string);
descr = descr->next;
- } while (descr != NULL && !(descr->flags & NODE_DELIMC));
+ } while (descr != punct);
outflags &= ~MD_spc;
/* Link target. */
md_rawword(")");
/* Trailing punctuation. */
- while (descr != NULL) {
- md_word(descr->string);
- descr = descr->next;
+ while (punct != NULL) {
+ md_word(punct->string);
+ punct = punct->next;
}
return 0;
}
-/* $OpenBSD: mdoc_term.c,v 1.256 2017/05/09 14:09:37 schwarze Exp $ */
+/* $OpenBSD: mdoc_term.c,v 1.257 2017/05/30 16:31:25 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org>
static int
termp_lk_pre(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) {
term_fontpush(p, TERMFONT_UNDER);
- while (descr != NULL && !(descr->flags & NODE_DELIMC)) {
+ while (descr != punct) {
+ if (descr->flags & (NODE_DELIMC | NODE_DELIMO))
+ p->flags |= TERMP_NOSPACE;
term_word(p, descr->string);
descr = descr->next;
}
term_fontpop(p);
/* Trailing punctuation. */
- while (descr != NULL) {
+ while (punct != NULL) {
p->flags |= TERMP_NOSPACE;
- term_word(p, descr->string);
- descr = descr->next;
+ term_word(p, punct->string);
+ punct = punct->next;
}
if (display)
term_newln(p);