mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Allow for simple conditions in name scheme.
I.e., only output a comma between last and first name if there is a first name.
This commit is contained in:
parent
08500c1a7c
commit
9f4df64f23
@ -32,9 +32,9 @@ CiteFormat default
|
||||
# Macros
|
||||
#
|
||||
# Scheme of the first author in the bibliography
|
||||
!firstnameform %surname%, %prename%
|
||||
!firstnameform %surname%{%prename%[[, %prename%]]}
|
||||
# Scheme of other authors in the bibliography
|
||||
!othernameform %surname%, %prename%
|
||||
!othernameform %surname%{%prename%[[, %prename%]]}
|
||||
# Scheme of the first name in later parts (such as book editor)
|
||||
!firstbynameform %prename% %surname%
|
||||
# Scheme of other authors in later parts (such as book editor)
|
||||
|
@ -151,7 +151,16 @@ docstring constructName(docstring const & name, string const scheme)
|
||||
// to a given scheme
|
||||
docstring const prename = nameParts(name).first;
|
||||
docstring const surname = nameParts(name).second;
|
||||
docstring result = from_ascii(scheme);
|
||||
string res = scheme;
|
||||
static regex const reg1("(.*)(\\{%prename%\\[\\[)([^\\]]+)(\\]\\]\\})(.*)");
|
||||
smatch sub;
|
||||
if (regex_match(scheme, sub, reg1)) {
|
||||
res = sub.str(1);
|
||||
if (!prename.empty())
|
||||
res += sub.str(3);
|
||||
res += sub.str(5);
|
||||
}
|
||||
docstring result = from_ascii(res);
|
||||
result = subst(result, from_ascii("%prename%"), prename);
|
||||
result = subst(result, from_ascii("%surname%"), surname);
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user