- // get the bibdata corresponding to the key
- docstring const author(biblist.getAbbreviatedAuthor(*it));
- docstring const year(biblist.getYear(*it));
-
- // Something isn't right. Fail safely.
- if (author.empty() || year.empty())
- return docstring();
-
- // authors1/<before>; ... ;
- // authors_last, <after>
- if (cite_type == "cite" && engine == biblio::ENGINE_JURABIB) {
- if (it == keys.begin())
- label += author + before_str + sep_str;
- else
- label += author + sep_str;
-
- // (authors1 (<before> year); ... ;
- // authors_last (<before> year, <after>)
- } else if (cite_type == "citet") {
- switch (engine) {
- case biblio::ENGINE_NATBIB_AUTHORYEAR:
- label += author + op_str + before_str +
- year + cp + sep_str;
- break;
- case biblio::ENGINE_NATBIB_NUMERICAL:
- label += author + op_str + before_str + '#' + *it + cp + sep_str;
- break;
- case biblio::ENGINE_JURABIB:
- label += before_str + author + op_str +
- year + cp + sep_str;
- break;
- case biblio::ENGINE_BASIC:
- break;
- }
-
- // author, year; author, year; ...
- } else if (cite_type == "citep" ||
- cite_type == "citealp") {
- if (engine == biblio::ENGINE_NATBIB_NUMERICAL) {
- label += *it + sep_str;
- } else {
- label += author + ", " + year + sep_str;
- }
-
- // (authors1 <before> year;
- // authors_last <before> year, <after>)
- } else if (cite_type == "citealt") {
- switch (engine) {
- case biblio::ENGINE_NATBIB_AUTHORYEAR:
- label += author + ' ' + before_str +
- year + sep_str;
- break;
- case biblio::ENGINE_NATBIB_NUMERICAL:
- label += author + ' ' + before_str + '#' + *it + sep_str;
- break;
- case biblio::ENGINE_JURABIB:
- label += before_str + author + ' ' +
- year + sep_str;
- break;
- case biblio::ENGINE_BASIC:
- break;
- }
-
- // author; author; ...
- } else if (cite_type == "citeauthor") {
- label += author + sep_str;
-
- // year; year; ...
- } else if (cite_type == "citeyear" ||
- cite_type == "citeyearpar") {
- label += year + sep_str;
- }
- }
- label = rtrim(rtrim(label), sep);
-
- if (!after_str.empty()) {
- if (cite_type == "citet") {
- // insert "after" before last ')'
- label.insert(label.size() - 1, after_str);
- } else {
- bool const add =
- !(engine == biblio::ENGINE_NATBIB_NUMERICAL &&
- (cite_type == "citeauthor" ||
- cite_type == "citeyear"));
- if (add)
- label += after_str;