[LyX/master] InsetHyperlink: make sure there is always some text in the link.

Thibaut Cuvelier <[email protected]>
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit 6afbc981ca9ee1b50264f6648b50347ac7a5d456
Author: Thibaut Cuvelier <[email protected]>
Date:   Fri Mar 6 19:22:21 2026 +0100

    InsetHyperlink: make sure there is always some text in the link.
    
    export/examples/ja/Modules/Linguistics had links with a `mailto` `href`, but no actual content.
---
 src/insets/InsetHyperlink.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/insets/InsetHyperlink.cpp b/src/insets/InsetHyperlink.cpp
index 1d51d6ac32..aeb63313d9 100644
--- a/src/insets/InsetHyperlink.cpp
+++ b/src/insets/InsetHyperlink.cpp
@@ -238,7 +238,11 @@ void InsetHyperlink::docbook(XMLStream & xs, OutputParams const &) const
 {
 	docstring target = subst(getParam("target"), from_ascii("&"), from_ascii("&amp;")) ;
 	xs << xml::StartTag("link", "xlink:href=\"" + makeURL(target, getParam("type")) + "\"");
-	xs << xml::escapeString(getParam("name"));
+	if (!getParam("name").empty()) {
+		xs << xml::escapeString(getParam("name"));
+	} else {
+		xs << xml::escapeString(getParam("type"));
+	}
 	xs << xml::EndTag("link");
 }
 
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.