#include "Author.h"
#include "support/convert.h"
+#include "support/gettext.h"
#include "support/lassert.h"
#include "support/lstrings.h"
}
-Author::Author(docstring const & name, docstring const & email)
- : name_(name), email_(email), used_(true),
+Author::Author(docstring const & name, docstring const & email, docstring const & initials)
+ : name_(name), email_(email), initials_(initials), used_(true),
buffer_id_(computeHash(name, email))
{}
Author::Author(int buffer_id)
- : name_(convert<docstring>(buffer_id)), email_(docstring()), used_(false),
+ : name_(convert<docstring>(buffer_id)), email_(docstring()), initials_(docstring()), used_(false),
buffer_id_(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.
bool operator==(Author const & l, Author const & r)
{
- return l.name() == r.name() && l.email() == r.email();
+ return l.name() == r.name() && l.email() == r.email() && l.initials() == r.initials();
}
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;
}