Compare commits

..

2 Commits

Author SHA1 Message Date
Juergen Spitzmueller
0beb790a6a Handle space issue with refstyle more downstream
It is not necessarily, and infers with some usages, to generally escape
spaces in labels and references
2024-09-08 19:07:44 +02:00
Juergen Spitzmueller
bfd855747a Fix indentation 2024-09-08 16:00:36 +02:00
2 changed files with 9 additions and 4 deletions

View File

@ -287,8 +287,13 @@ void InsetRef::latex(otexstream & os, OutputParams const & rp) const
getFormattedCmd(data, label, prefix, use_refstyle, use_caps); getFormattedCmd(data, label, prefix, use_refstyle, use_caps);
os << fcmd; os << fcmd;
if (use_refstyle && use_plural) if (use_refstyle && use_plural)
os << "[s]"; 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") { else if (cmd == "labelonly") {
docstring const & ref = getParam("reference"); docstring const & ref = getParam("reference");
@ -298,7 +303,7 @@ void InsetRef::latex(otexstream & os, OutputParams const & rp) const
docstring prefix; docstring prefix;
docstring suffix = split(ref, prefix, ':'); docstring suffix = split(ref, prefix, ':');
if (suffix.empty()) { if (suffix.empty()) {
LYXERR0("Label `" << ref << "' contains no `:' separator."); LYXERR0("Label `" << ref << "' contains no `:' separator.");
os << ref; os << ref;
} else { } else {
os << suffix; os << suffix;

View File

@ -1237,7 +1237,7 @@ docstring const escape(docstring const & lab)
for (char_type const c : lab) { for (char_type const c : lab) {
if (c >= 128 || c == '=' || c == '%' || c == '#' || c == '$' if (c >= 128 || c == '=' || c == '%' || c == '#' || c == '$'
|| c == '}' || 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 // Although char_type is a 32 bit type we know that
// UCS4 occupies only 21 bits, so we don't need to // UCS4 occupies only 21 bits, so we don't need to