commit 65ad535ce3aeead9fd725e057e0088b78c5b74be
Author: Juergen Spitzmueller <[email protected]>
Date: Sat May 17 17:49:22 2025 +0200
Refine refprefix whitespace workaround
Only need this for known refprefix commands, with others,
the refs will break
---
src/TextClass.cpp | 9 +++++++++
src/TextClass.h | 2 ++
src/insets/InsetRef.cpp | 7 +++++--
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index a41ef8a461..b24afea19b 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -2065,6 +2065,15 @@ bool DocumentClass::hasLaTeXLayout(std::string const &
lay) const
}
+bool DocumentClass::hasRefPrefix(docstring const & pr) const
+{
+ for (auto const & l : layoutlist_)
+ if (l.refprefix == pr)
+ return true;
+ return false;
+}
+
+
bool DocumentClass::provides(string const & p) const
{
return provides_.find(p) != provides_.end();
diff --git a/src/TextClass.h b/src/TextClass.h
index ef5ed7789e..c7c6214f79 100644
--- a/src/TextClass.h
+++ b/src/TextClass.h
@@ -437,6 +437,8 @@ public:
///////////////////////////////////////////////////////////////////
/// \return true if there is a Layout with latexname lay
bool hasLaTeXLayout(std::string const & lay) const;
+ /// \return true if there is a Layout with refprefix pr
+ bool hasRefPrefix(docstring const & pr) const;
/// A DocumentClass nevers count as loaded, since it is dynamic
bool loaded() const override { return false; }
/// \return the layout object of an inset given by name. If the name
diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp
index 1019b3a8fc..970d5a5c9e 100644
--- a/src/insets/InsetRef.cpp
+++ b/src/insets/InsetRef.cpp
@@ -24,6 +24,7 @@
#include "ParIterator.h"
#include "PDFOptions.h"
#include "Statistics.h"
+#include "TextClass.h"
#include "xml.h"
#include "texstream.h"
#include "TocBackend.h"
@@ -390,8 +391,10 @@ void InsetRef::latex(otexstream & os, OutputParams const &
rp) const
else
os << ",";
}
- if (contains(*it, ' ') &&
!prefixIs(buffer().masterParams().xref_package, "prettyref"))
- // refstyle bug: labels with blanks need to be
grouped
+ if (contains(*it, ' ') &&
prefixIs(buffer().masterParams().xref_package, "refstyle")
+ &&
buffer().params().documentClass().hasRefPrefix(prefix))
+ // refstyle bug: labels with blanks need to be
grouped for known commands
+ // (basically those with known refprefixes)
// otherwise the blanks will be gobbled
os << "{" << *it << "}";
else {
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs