mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Move protectArgument function to lstrings
This will be useful to other insets as well.
This commit is contained in:
parent
83074c431c
commit
c59375d679
@ -312,15 +312,6 @@ inline docstring wrapCitation(docstring const & key,
|
||||
html::htmlize(content, XHTMLStream::ESCAPE_ALL) + "</a>";
|
||||
}
|
||||
|
||||
docstring protectArgument(docstring & arg, char const l = '[',
|
||||
char const r = ']')
|
||||
{
|
||||
if (contains(arg, l) || contains(arg, r))
|
||||
// protect brackets
|
||||
arg = '{' + arg + '}';
|
||||
return arg;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
|
@ -1203,6 +1203,16 @@ docstring const escape(docstring const & lab)
|
||||
}
|
||||
|
||||
|
||||
docstring const protectArgument(docstring & arg, char const l,
|
||||
char const r)
|
||||
{
|
||||
if (contains(arg, l) || contains(arg, r))
|
||||
// protect brackets
|
||||
arg = '{' + arg + '}';
|
||||
return arg;
|
||||
}
|
||||
|
||||
|
||||
bool truncateWithEllipsis(docstring & str, size_t const len)
|
||||
{
|
||||
if (str.size() <= len)
|
||||
|
@ -269,6 +269,10 @@ docstring const rsplit(docstring const & a, char_type delim);
|
||||
/// problems in latex labels.
|
||||
docstring const escape(docstring const & lab);
|
||||
|
||||
/// Group contents of an argument if needed
|
||||
docstring const protectArgument(docstring & arg, char const l = '[',
|
||||
char const r = ']');
|
||||
|
||||
/// Truncates a string with an ellipsis at the end. Leaves str unchanged and
|
||||
/// returns false if it is shorter than len. Otherwise resizes str to len, with
|
||||
/// U+2026 HORIZONTAL ELLIPSIS at the end, and returns true.
|
||||
|
Loading…
Reference in New Issue
Block a user