commit 99ff541f15598ea4fe99dde33c854a4c2fbbadd7
Author: Thibaut Cuvelier <[email protected]>
Date:   Fri Jul 18 06:48:44 2025 +0200

    References in DocBook: stop using screenLabel, go instead of the "name" 
parameter.
    
    The parameter is what xrefs use to determine the target. screenLabel is 
also marked as TODO private, indicating it should not be used.
---
 src/insets/InsetFloat.cpp | 12 ++++++------
 src/insets/InsetRef.cpp   |  2 +-
 src/output_docbook.cpp    |  4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp
index d0cf63d8c1..2a725065b4 100644
--- a/src/insets/InsetFloat.cpp
+++ b/src/insets/InsetFloat.cpp
@@ -578,12 +578,12 @@ void docbookSubfigures(XMLStream & xs, OutputParams const 
& runparams, const Ins
        // Ensure there is no label output, it is supposed to be handled as 
xml:id.
        OutputParams rpNoLabel = runparams;
        if (label)
-               
rpNoLabel.docbook_anchors_to_ignore.emplace(label->screenLabel());
+               
rpNoLabel.docbook_anchors_to_ignore.emplace(label->getParam("name"));
 
        // First, open the formal group.
        docstring attr = docstring();
        if (label)
-               attr += "xml:id=\"" + xml::cleanID(label->screenLabel()) + "\"";
+               attr += "xml:id=\"" + xml::cleanID(label->getParam("name")) + 
"\"";
 
        xs.startDivision(false);
        xs << xml::StartTag("formalgroup", attr);
@@ -662,7 +662,7 @@ void docbookSubfigures(XMLStream & xs, OutputParams const & 
runparams, const Ins
 
                                // Ensure there is no label output, it is 
supposed to be handled as xml:id.
                                if (slabel)
-                                       
rpNoLabel.docbook_anchors_to_ignore.emplace(slabel->screenLabel());
+                                       
rpNoLabel.docbook_anchors_to_ignore.emplace(slabel->getParam("name"));
 
                                // Ensure the float does not output its 
caption, as it is handled here (DocBook mandates a specific place for
                                // captions, they cannot appear at the end of 
the float, albeit LyX is happy with that).
@@ -674,7 +674,7 @@ void docbookSubfigures(XMLStream & xs, OutputParams const & 
runparams, const Ins
                                // Organisation: <float> <title if any/> 
<contents without title/> </float>.
                                docstring sattr = docstring();
                                if (slabel)
-                                       sattr += "xml:id=\"" + 
xml::cleanID(slabel->screenLabel()) + "\"";
+                                       sattr += "xml:id=\"" + 
xml::cleanID(slabel->getParam("name")) + "\"";
                                // No layout way of adding attributes, unlike 
the normal code path.
 
                                xs << xml::StartTag(stag, sattr);
@@ -755,7 +755,7 @@ void docbookNoSubfigures(XMLStream & xs, OutputParams const 
& runparams, const I
        // Ensure there is no label output, it is supposed to be handled as 
xml:id.
        OutputParams rpNoLabel = runparams;
        if (label)
-               
rpNoLabel.docbook_anchors_to_ignore.emplace(label->screenLabel());
+               
rpNoLabel.docbook_anchors_to_ignore.emplace(label->getParam("name"));
 
        // Ensure the float does not output its caption, as it is handled here 
(DocBook mandates a specific place for
        // captions, they cannot appear at the end of the float, albeit LyX is 
happy with that).
@@ -790,7 +790,7 @@ void docbookNoSubfigures(XMLStream & xs, OutputParams const 
& runparams, const I
        // - Generate the attributes for the float tag.
        docstring attr = docstring();
        if (label)
-               attr += "xml:id=\"" + xml::cleanID(label->screenLabel()) + "\"";
+               attr += "xml:id=\"" + xml::cleanID(label->getParam("name")) + 
"\"";
        if (!ftype.docbookAttr().empty()) {
                if (!attr.empty())
                        attr += " ";
diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp
index 3bef74abc7..ac0e3b9ac2 100644
--- a/src/insets/InsetRef.cpp
+++ b/src/insets/InsetRef.cpp
@@ -599,7 +599,7 @@ void InsetRef::docbook(XMLStream & xs, OutputParams const & 
rp) const
        //     on page 4, on page 5, on page 6
        // for three references, with each of the "on page #" being
        // generated by the DocBook processor.
-       vector<docstring> labels = getVectorFromString(getEscapedLabel(rp));
+       vector<docstring> labels = getVectorFromString(getParam("reference"));
        string const & cmd = params().getCmdName();
 
        // A name is provided, LyX will provide it. This is supposed to be a 
very rare case.
diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp
index 4e246622e9..3ab34e3361 100644
--- a/src/output_docbook.cpp
+++ b/src/output_docbook.cpp
@@ -1278,10 +1278,10 @@ void docbookParagraphs(Text const &text,
                                        if (inset) {
                                                if (auto label = 
dynamic_cast<InsetLabel const *>(inset)) {
                                                        // Generate the 
attributes for the section if need be.
-                                                       id += "xml:id=\"" + 
xml::cleanID(label->screenLabel()) + "\"";
+                                                       id += "xml:id=\"" + 
xml::cleanID(label->getParam("name")) + "\"";
 
                                                        // Don't output the ID 
as a DocBook <anchor>.
-                                                       
ourparams.docbook_anchors_to_ignore.emplace(label->screenLabel());
+                                                       
ourparams.docbook_anchors_to_ignore.emplace(label->getParam("name"));
 
                                                        // Cannot have multiple 
IDs per tag. If there is another ID inset in the document, it will
                                                        // be output as a 
DocBook anchor.
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to