#include "Author.h"
#include "support/convert.h"
+#include "support/gettext.h"
#include "support/lassert.h"
#include "support/lstrings.h"
{}
+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.
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;
}
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;
}