// If we have no result, check in the cross-ref'ed entries
if (ret.empty() && !xrefs.empty()) {
+ bool const biblatex =
+ buf.params().documentClass().citeFramework() == "biblatex";
// xr is a (reference to a) BibTeXInfo const *
for (auto const & xr : xrefs) {
if (!xr)
if (!ret.empty())
// success!
break;
+ // in biblatex, cross-ref'ed titles are mapped
+ // to booktitle. Same for subtitle etc.
+ if (biblatex && prefixIs(key, "book"))
+ ret = (*xr)[key.substr(4)];
+ // likewise, author is maped onto bookauthor
+ else if (biblatex && contains(key, ":bookauthor"))
+ ret = xr->getValueForKey(subst(key, "bookauthor", "author"),
+ buf, ci, xr_dummy, maxsize);
+ if (!ret.empty())
+ // success!
+ break;
}
}
}
-docstring authorsToDocBookAuthorGroup(docstring const & authorsString, XMLStream & xs, Buffer const & buf)
+void authorsToDocBookAuthorGroup(docstring const & authorsString, XMLStream & xs, Buffer const & buf,
+ const std::string type)
{
// This function closely mimics getAuthorList, but produces DocBook instead of text.
// It has been greatly simplified, as the complete list of authors is always produced. No separators are required,
// as the output has a database-like shape.
// constructName has also been merged within, as it becomes really simple and leads to no copy-paste.
+ if (! type.empty() && (type != "author" && type != "book")) {
+ LYXERR0("ERROR! Unexpected author contribution `" << type <<"'.");
+ return;
+ }
+
if (authorsString.empty()) {
- return docstring();
+ return;
}
// Split the input list of authors into individual authors.
auto it = authors.cbegin();
auto en = authors.cend();
for (size_t i = 0; it != en; ++it, ++i) {
- xs << xml::StartTag("author");
+ const std::string tag = (type.empty() || type == "author") ? "author" : "othercredit";
+ const std::string attr = (type == "book") ? R"(class="other" otherclass="bookauthor")" : "";
+
+ xs << xml::StartTag(tag, attr);
xs << xml::CR();
xs << xml::StartTag("personname");
xs << xml::CR();
- docstring name = *it;
+ const docstring name = *it;
- // All authors go in a <personname>. If more structure is known, use it; otherwise (just "et al."), print it as such.
+ // All authors go in a <personname>. If more structure is known, use it; otherwise (just "et al."),
+ // print it as such.
if (name == "others") {
xs << buf.B_(etal);
} else {
xs << xml::EndTag("personname");
xs << xml::CR();
- xs << xml::EndTag("author");
+ xs << xml::EndTag(tag);
xs << xml::CR();
// Could add an affiliation after <personname>, but not stored in BibTeX.
}
xs << xml::EndTag("authorgroup");
xs << xml::CR();
-
- return docstring();
}
} // namespace lyx