]> git.lyx.org Git - lyx.git/commitdiff
Handle space issue with refstyle more downstream
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 8 Sep 2024 17:07:44 +0000 (19:07 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 8 Sep 2024 17:07:44 +0000 (19:07 +0200)
It is not necessarily, and infers with some usages, to generally escape
spaces in labels and references

src/insets/InsetRef.cpp
src/support/lstrings.cpp

index d2a5e72c802fe5a91b9e56fc3dfe0b8287df8d9a..29a8c52831683453b224af5443ad165fa1461a1b 100644 (file)
@@ -288,7 +288,12 @@ void InsetRef::latex(otexstream & os, OutputParams const & rp) const
                os << fcmd;
                if (use_refstyle && use_plural)
                        os << "[s]";
-               os << '{' << label << '}';
+               if (contains(label, ' '))
+                       // refstyle bug: labels with blanks need to be grouped
+                       // otherwise the blanks will be gobbled
+                       os << "{{" << label << "}}";
+               else
+                       os << '{' << label << '}';
        }
        else if (cmd == "labelonly") {
                docstring const & ref = getParam("reference");
index 5d0c37694d7c7a4ca6005dd0590a9ae202c53371..6cc99ad17677509699cacd69a17a7f2aab58e045 100644 (file)
@@ -1237,7 +1237,7 @@ docstring const escape(docstring const & lab)
        for (char_type const c : lab) {
                if (c >= 128 || c == '=' || c == '%' || c == '#' || c == '$'
                    || c == '}' || c == '{' || c == ']' || c == '[' || c == '&'
-                   || c == '\\' || c == ' ') // refstyle doesn't support spaces
+                   || c == '\\')
                {
                        // Although char_type is a 32 bit type we know that
                        // UCS4 occupies only 21 bits, so we don't need to