commit 9d166c3dd1355fa63fc16bff02d9e37cacce41cc
Author: Juergen Spitzmueller <[email protected]>
Date: Sat Jul 26 07:45:48 2025 +0200
Let URL inset produce proper hyperlinks in XHTML output (part of #13189)
---
lib/doc/Customization.lyx | 66 ++++++++++++++++++++++++++++++++++++++++++--
lib/doc/de/Customization.lyx | 38 +++++++++++++++++++++++--
lib/layouts/stdinsets.inc | 2 ++
src/insets/InsetText.cpp | 7 +++--
4 files changed, 106 insertions(+), 7 deletions(-)
diff --git a/lib/doc/Customization.lyx b/lib/doc/Customization.lyx
index 95420a07c5..137d879386 100644
--- a/lib/doc/Customization.lyx
+++ b/lib/doc/Customization.lyx
@@ -1,5 +1,5 @@
#LyX 2.5 created this file. For more info see https://www.lyx.org/
-\lyxformat 640
+\lyxformat 641
\begin_document
\begin_header
\save_transient_properties true
@@ -101,7 +101,7 @@ logicalmkup
\use_indices false
\paperorientation portrait
\suppress_date false
-\justification true
+\justification default
\crossref_package prettyref
\use_formatted_ref 0
\use_minted 0
@@ -18716,6 +18716,8 @@ status collapsed
\change_inserted -712698321 1751702464
Preamble
+\change_unchanged
+
\end_layout
\end_inset
@@ -18738,6 +18740,8 @@ status collapsed
\change_inserted -712698321 1751702464
EndPreamble
+\change_unchanged
+
\end_layout
\end_inset
@@ -29163,7 +29167,13 @@ string
status collapsed
\begin_layout Plain Layout
-class=`insetname_inner'
+class=
+\change_deleted -712698321 1753508399
+`
+\change_inserted -712698321 1753508400
+'
+\change_unchanged
+insetname_inner'
\end_layout
\end_inset
@@ -29173,6 +29183,56 @@ class=`insetname_inner'
\end_inset
.
+
+\change_inserted -712698321 1753508560
+ The placeholder
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1753508431
+$$content
+\change_unchanged
+
+\end_layout
+
+\end_inset
+
+ can be used to represent the content of the inset (e.
+\begin_inset space \thinspace{}
+\end_inset
+
+g.,
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1753508520
+href='$$content'
+\change_unchanged
+
+\end_layout
+
+\end_inset
+
+ for insets producing hyperlinks with
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1753508560
+HTMLInnerTag a
+\end_layout
+
+\end_inset
+
+).
+\change_unchanged
+
\end_layout
\begin_layout Description
diff --git a/lib/doc/de/Customization.lyx b/lib/doc/de/Customization.lyx
index 1cd8813ce9..17f1286426 100644
--- a/lib/doc/de/Customization.lyx
+++ b/lib/doc/de/Customization.lyx
@@ -1,5 +1,5 @@
#LyX 2.5 created this file. For more info see https://www.lyx.org/
-\lyxformat 640
+\lyxformat 641
\begin_document
\begin_header
\save_transient_properties true
@@ -109,7 +109,7 @@ logicalmkup
\use_indices false
\paperorientation portrait
\suppress_date false
-\justification true
+\justification default
\crossref_package prettyref
\use_formatted_ref 0
\use_minted 0
@@ -28170,6 +28170,40 @@ insetname_inner
\end_inset
.
+ Der Platzhalter
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+$$content
+\end_layout
+
+\end_inset
+
+ kann verwendet werden,
+ um den Inhalt der Einfügung zu repräsentieren (bspw.
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+href='$$content'
+\end_layout
+
+\end_inset
+
+ für Einfügungen mit
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+HTMLInnerTag a
+\end_layout
+
+\end_inset
+
+,
+ die Links produzieren).
\end_layout
\begin_layout Description
diff --git a/lib/layouts/stdinsets.inc b/lib/layouts/stdinsets.inc
index 790d24d1b1..72667ed9a0 100644
--- a/lib/layouts/stdinsets.inc
+++ b/lib/layouts/stdinsets.inc
@@ -681,6 +681,8 @@ InsetLayout "Flex:URL"
Size Small
EndFont
HTMLIsBlock false
+ HTMLInnerTag a
+ HTMLInnerAttr href='$$content'
DocBookTag link
DocBookTagType inline
End
diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index 4aa8dbbb16..b982a8d54d 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -915,8 +915,11 @@ void InsetText::insetAsXHTML(XMLStream & xs, OutputParams
const & rp,
}
}
- if (opts & WriteInnerTag)
- xs << xml::StartTag(il.htmlinnertag(), il.htmlinnerattr());
+ if (opts & WriteInnerTag) {
+ string inner_attr = il.htmlinnerattr();
+ inner_attr = subst(inner_attr, "$$content",
to_utf8(text_.asString(AS_STR_INSETS)));
+ xs << xml::StartTag(il.htmlinnertag(), inner_attr);
+ }
// we will eventually lose information about the containing inset
if (!allowMultiPar() || opts == JustText)
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs