Consider that "and" in BibTeX name lists is case-insensitive (#10465)

This commit is contained in:
Juergen Spitzmueller 2022-02-19 11:55:29 +01:00
parent 69ba7f1536
commit fcc139b06e

View File

@ -277,8 +277,14 @@ vector<docstring> const getAuthors(docstring const & author)
// in author names, but can happen (consider cases such as "C \& A Corp."). // in author names, but can happen (consider cases such as "C \& A Corp.").
docstring iname = subst(author, from_ascii("&"), from_ascii("$$amp!")); docstring iname = subst(author, from_ascii("&"), from_ascii("$$amp!"));
// Then, we temporarily make all " and " strings to ampersands in order // Then, we temporarily make all " and " strings to ampersands in order
// to handle them later on a per-char level. // to handle them later on a per-char level. Note that arbitrary casing
iname = subst(iname, from_ascii(" and "), from_ascii(" & ")); // ("And", "AND", "aNd", ...) is allowed in bibtex (#10465).
static regex const and_reg("(.* )([aA][nN][dD])( .*)");
smatch sub;
string res = to_utf8(iname);
while (regex_match(res, sub, and_reg))
res = sub.str(1) + "&" + sub.str(3);
iname = from_utf8(res);
// Now we traverse through the string and replace the "&" by the proper // Now we traverse through the string and replace the "&" by the proper
// output in- and outside groups // output in- and outside groups
docstring name; docstring name;