Book authorship and authorship can be quite distinct. As far as I know, there is no standard way to represent book authorship in DocBook bibliographies.
</personname>
</author>
</authorgroup>
-<!-- Several author tags in the reference. Other editor tag: fullbynames:bookauthor. Corresponding value: Michel Foucault -->
+<authorgroup>
+<othercredit class="other" otherclass="bookauthor">
+<personname>
+<firstname>Michel</firstname>
+<surname>Foucault</surname>
+</personname>
+</othercredit>
+</authorgroup>
</biblioentry>
<biblioentry xml:id="small">
<title>A small paper</title>
}
-void 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;
}
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();
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.
std::string citationStyleToString(CitationStyle const &, bool const latex = false);
/// Transforms the information about authors into a <authorgroup> (directly written to a XMLStream).
-void authorsToDocBookAuthorGroup(docstring const & authorsString, XMLStream & xs, Buffer const & buf);
+/// Type: "author" or empty means author of the entry (article, book, etc.); "book" means author of the book
+/// (but not necessarily of this entry in particular).
+void authorsToDocBookAuthorGroup(docstring const & authorsString, XMLStream & xs, Buffer const & buf,
+ std::string type);
/// Class to represent information about a BibTeX or
// <authorgroup>
// Example: http://tdg.docbook.org/tdg/5.1/authorgroup.html
- if (hasTag("fullnames:author") || hasTag("fullbynames:bookauthor")) {
- // If several author tags are present, only output one.
- const docstring authorName = getTag(
- hasTag("fullnames:author") ? "fullnames:author" : "fullbynames:bookauthor");
-
- // Perform full parsing of the BibTeX string, dealing with the many corner cases that might
- // be encountered.
- authorsToDocBookAuthorGroup(authorName, xs, buffer());
-
- if (hasTag("fullnames:author") && hasTag("fullbynames:bookauthor")) {
- xs << XMLStream::ESCAPE_NONE <<
- from_utf8("<!-- Several author tags in the reference. Other editor tag: ") +
- from_utf8("fullbynames:bookauthor. Corresponding value: ") +
- getTag("fullbynames:bookauthor") + from_utf8(" -->\n");
- }
-
- // Erase all author tags that might be present, even if only one is output.
- if (hasTag("fullnames:author")) {
- eraseTag("fullnames:author");
- }
- if (hasTag("fullbynames:bookauthor")) {
- eraseTag("fullbynames:bookauthor");
- }
+ // Perform full parsing of the BibTeX string, dealing with the many corner cases that might
+ // be encountered.
+ if (hasTag("fullnames:author")) {
+ authorsToDocBookAuthorGroup(getTag("fullnames:author"), xs, buffer(), "author");
+ eraseTag("fullnames:author");
+ }
+ if (hasTag("fullbynames:bookauthor")) {
+ authorsToDocBookAuthorGroup(getTag("fullbynames:bookauthor"), xs, buffer(), "book");
+ eraseTag("fullbynames:bookauthor");
}
// <editor>