diff --git a/lib/layouts/stdciteformats.inc b/lib/layouts/stdciteformats.inc index 96573755a6..67530bfa28 100644 --- a/lib/layouts/stdciteformats.inc +++ b/lib/layouts/stdciteformats.inc @@ -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) diff --git a/src/BiblioInfo.cpp b/src/BiblioInfo.cpp index 6dc976ccf5..1d15f2f3ee 100644 --- a/src/BiblioInfo.cpp +++ b/src/BiblioInfo.cpp @@ -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;