X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FAuthor.cpp;h=3d03fe71131ada993ade5301978261f1acbfa772;hb=c7d29be153debac82e3d2e8865fcc849f0a5f40d;hp=d44af3df4994478716d10c6422b537a15411e7ed;hpb=86bd1cd641daade1524a6edf7b3f733117e8afc7;p=lyx.git diff --git a/src/Author.cpp b/src/Author.cpp index d44af3df49..3d03fe7113 100644 --- a/src/Author.cpp +++ b/src/Author.cpp @@ -13,6 +13,7 @@ #include "Author.h" #include "support/convert.h" +#include "support/gettext.h" #include "support/lassert.h" #include "support/lstrings.h" @@ -48,6 +49,15 @@ Author::Author(int buffer_id) {} +docstring Author::nameAndEmail() const +{ + if (email().empty()) + return name(); + else + return bformat(_("%1$s[[name]] (%2$s[[email]])"), name(), email()); +} + + bool Author::valid() const { //this cannot be equal if the buffer_id was produced by the hash function. @@ -64,8 +74,9 @@ bool operator==(Author const & l, Author const & r) ostream & operator<<(ostream & os, Author const & a) { // FIXME UNICODE - os << a.buffer_id_ << " \"" << to_utf8(a.name_) - << "\" " << to_utf8(a.email_); + os << a.buffer_id_ << " \"" << to_utf8(a.name_) << "\""; + if (!a.email_.empty()) + os << " " << to_utf8(a.email_); return os; } @@ -173,7 +184,7 @@ ostream & operator<<(ostream & os, AuthorList const & a) for (; a_it != a_end; ++a_it) { if (a_it->used() && a_it->valid()) - os << "\\author " << *a_it << "\n"; + os << "\\author " << *a_it << "\n"; } return os; }