Outsource jurabib specials to the style file.

This commit is contained in:
Juergen Spitzmueller 2017-01-07 17:40:23 +01:00
parent fa2cbb730c
commit 378a2c8257
2 changed files with 12 additions and 25 deletions

View File

@ -129,16 +129,24 @@ CiteFormat authoryear
!open (
!sep ;
!close )
!obracket [
!cbracket ]
# A link that lets us jump to the bibliography entry in LyXHTML
# %clean:key% will be substituted by the cite key to give a unique id
!startlink {!<a href='#LyXCite-%clean:key%'>!}
!endlink {!</a>!}
# "ShortAuthor" or "??"
!shortauthor {%shortauthor%[[%shortauthor%]][[??]]}
# "... ShortTitle" (button) / "... ShortTitle <short title>" (dialog)
!shorttitle {%shorttitle%[[ %shorttitle%]][[{%dialog%[[ <%_shorttitle%>]]}]]}
# "ShortAuthor", "Author" or "??"
!shortauthor {%shortauthor%[[%shortauthor%]][[{%abbrvauthor%[[%abbrvauthor%]][[??]]}]]}
# "... ShortTitle"
!shorttitle {%shorttitle%[[ %shorttitle%]][[{%dialog%[[ <%_shorttitle%>]][[%!makejurashorttitle%]]}]]}
# Title or "??"
!maketitle {%title%[[ %title%]][[ ??]]}
# "Journal Volume [Year]"
!jurashorttitle {%journal%[[ %journal%]]}{%volume%[[ %volume%]]}{%year%[[ %!obracket%%year%%!cbracket%]]}
# Handle short title fallback
!makejurashorttitle {%ifentrytype:article%[[%!jurashorttitle%]][[{%ifentrytype:periodical%[[%!jurashorttitle%]][[ %!maketitle%]]}]]}
# "prenote "
!textbefore {%textbefore%[[%textbefore% ]]}
# "/prenote" (button) / "/prenote/<before>" (dialog)

View File

@ -292,13 +292,6 @@ docstring const BibTeXInfo::getAuthorList(
vector<docstring> const authors =
getVectorFromString(author, from_ascii(" and "));
if (jurabib_style && (authors.size() == 2 || authors.size() == 3)) {
docstring shortauthor = familyName(authors[0])
+ "/" + familyName(authors[1]);
if (authors.size() == 3)
shortauthor += "/" + familyName(authors[2]);
return convertLaTeXCommands(shortauthor);
}
docstring retval;
CiteEngineType const engine_type = buf ? buf->params().citeEngineType()
@ -763,20 +756,6 @@ docstring BibTeXInfo::getValueForKey(string const & oldkey, Buffer const & buf,
ret = modifier_;
else if (key == "numericallabel")
ret = cite_number_;
else if (key == "shortauthor")
// When shortauthor is not defined, jurabib automatically
// provides jurabib-style abbreviated author names. We do
// this as well.
ret = getAbbreviatedAuthor(&buf, true);
else if (key == "shorttitle") {
// When shorttitle is not defined, jurabib uses for `article'
// and `periodical' entries the form `journal volume [year]'
// and for other types of entries it uses the `title' field.
if (entry_type_ == "article" || entry_type_ == "periodical")
ret = operator[]("journal") + " " + operator[]("volume")
+ " [" + operator[]("year") + "]";
else
ret = operator[]("title");
else if (key == "abbrvauthor") {
// Special key to provide abbreviated author names,
// with respect to maxcitenames.