From fd01a48e871d5f9e009ee0585ad5e5837dfc9d8c Mon Sep 17 00:00:00 2001 From: schwarze Date: Mon, 19 Jun 2017 12:53:50 +0000 Subject: [PATCH] Fix a regression in the previous revision: When there is no link description, reuse the URI. Reported by tj@ and bentley@. --- usr.bin/mandoc/mdoc_html.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c index 1fb8236c273..ec6d155311f 100644 --- a/usr.bin/mandoc/mdoc_html.c +++ b/usr.bin/mandoc/mdoc_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_html.c,v 1.164 2017/05/30 16:31:25 schwarze Exp $ */ +/* $OpenBSD: mdoc_html.c,v 1.165 2017/06/19 12:53:50 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze @@ -1320,12 +1320,16 @@ mdoc_lk_pre(MDOC_ARGS) punct = punct->next; /* Link target and link text. */ + descr = link->next; + if (descr == punct) + descr = link; /* no text */ t = print_otag(h, TAG_A, "cTh", "Lk", link->string); - for (descr = link->next; descr != punct; descr = descr->next) { + do { if (descr->flags & (NODE_DELIMC | NODE_DELIMO)) h->flags |= HTML_NOSPACE; print_text(h, descr->string); - } + descr = descr->next; + } while (descr != punct); print_tagq(h, t); /* Trailing punctuation. */ -- 2.20.1