buffer().params().documentClass().addCiteMacro("!textafter", to_utf8(after));
*/
docstring label;
- vector<docstring> keys = getVectorFromString(key);
+ // we only really want the last 'false', to suppress trimming, but
+ // we need to give the other defaults, too, to set it.
+ vector<docstring> keys =
+ getVectorFromString(key, from_ascii(","), false, false);
CitationStyle cs = getCitationStyle(buffer().masterParams(),
- cite_type, buffer().masterParams().citeStyles());
+ cite_type, buffer().masterParams().citeStyles());
bool const qualified = cs.hasQualifiedList
&& (keys.size() > 1
|| !getParam("pretextlist").empty()
do {
// if there is no comma, then everything goes into key
// and keys will be empty.
- keys = trim(split(keys, key, ','));
- key = trim(key);
+ keys = split(keys, key, ',');
if (!label.empty())
label += ", ";
label += wrapCitation(key, key, for_xhtml);
namespace {
template<typename String> vector<String> const
-getVectorFromStringT(String const & str, String const & delim, bool keepempty)
+getVectorFromStringT(String const & str, String const & delim,
+ bool keepempty, bool trimit)
{
// Lars would like this code to go, but for now his replacement (below)
// doesn't fullfil the same function. I have, therefore, reactivated the
vector<String> vec;
if (str.empty())
return vec;
- String keys = rtrim(str);
+ String keys = trimit ? rtrim(str) : str;
while (true) {
size_t const idx = keys.find(delim);
if (idx == String::npos) {
- vec.push_back(ltrim(keys));
+ vec.push_back(trimit ? ltrim(keys) : keys);
break;
}
- String const key = trim(keys.substr(0, idx));
+ String const key = trimit ?
+ trim(keys.substr(0, idx)) : keys.substr(0, idx);
if (!key.empty() || keepempty)
vec.push_back(key);
size_t const start = idx + delim.size();
vector<string> const getVectorFromString(string const & str,
- string const & delim,
- bool keepempty)
+ string const & delim, bool keepempty, bool trimit)
{
- return getVectorFromStringT<string>(str, delim, keepempty);
+ return getVectorFromStringT<string>(str, delim, keepempty, trimit);
}
vector<docstring> const getVectorFromString(docstring const & str,
- docstring const & delim,
- bool keepempty)
+ docstring const & delim, bool keepempty, bool trimit)
{
- return getVectorFromStringT<docstring>(str, delim, keepempty);
+ return getVectorFromStringT<docstring>(str, delim, keepempty, trimit);
}
/// gives a vector of stringparts which have the delimiter delim
/// If \p keepempty is true, empty strings will be pushed to the vector as well
+/// If \p trimit is true, leading and trailing whitespace will be trimmed from
+/// all values. Note that this can affect what counts as "empty".
std::vector<std::string> const getVectorFromString(std::string const & str,
- std::string const & delim = std::string(","),
- bool keepempty = false);
+ std::string const & delim = std::string(","),
+ bool keepempty = false, bool trimit = true);
std::vector<docstring> const getVectorFromString(docstring const & str,
- docstring const & delim = from_ascii(","), bool keepempty = false);
+ docstring const & delim = from_ascii(","),
+ bool keepempty = false, bool trimit = true);
/// the same vice versa
std::string const getStringFromVector(std::vector<std::string> const & vec,
- Recalculate citation insets when bibliography info changes as a result
of undo or redo (bug 11005).
+- Allow for spaces in bibliography keys (bug 9847).
+
* INTERNALS