New tag MaxCiteNames

This determines the number of authors before "et al.". We had it
hardcoded to 2, but actually the nuumber differs.
This commit is contained in:
Juergen Spitzmueller 2017-01-07 16:44:27 +01:00
parent 23c231c761
commit 979294d5ec
6 changed files with 28 additions and 7 deletions

View File

@ -7,7 +7,7 @@
# Author: Julien Rioux <jrioux@lyx.org>
Format 62
Format 63
# The framework (biblatex|bibtex)
CiteFramework bibtex

View File

@ -8,7 +8,7 @@
# Author: Julien Rioux <jrioux@lyx.org>
Format 62
Format 63
Requires jurabib
@ -22,6 +22,9 @@ CiteEngineType authoryear
# Default style file
DefaultBiblio jurabib
# Maximum number of names before "et al." chimes in
MaxCiteNames 3
# The syntax of the cite command definitions below is:
# LyXName|alias*<!_stardesc!_stardesctooltip>[][]=latexcmd

View File

@ -9,7 +9,7 @@
# Author: Julien Rioux <jrioux@lyx.org>
Format 62
Format 63
Requires natbib
@ -23,6 +23,9 @@ CiteEngineType authoryear|numerical
# Default style files for either engine type
DefaultBiblio authoryear:plainnat|numerical:plainnat
# Maximum number of names before "et al." chimes in
MaxCiteNames 2
# The syntax of the cite command definitions below is:
# LyXName|alias*<!_stardesc!_stardesctooltip>[][]=latexcmd

View File

@ -11,7 +11,7 @@
# This script will update a .layout file to current format
# The latest layout format is also defined in src/TextClass.cpp
currentFormat = 62
currentFormat = 63
# Incremented to format 4, 6 April 2007, lasgouttes
@ -208,6 +208,10 @@ currentFormat = 62
# Incremented to format 62, 21 October 2016 by spitz
# New Layout argument tag "PassThru"
# Incremented to format 63, 7 January 2017 by spitz
# - New textclass tags CiteFramework, MaxCiteNames (for cite engines)
# - Extended InsetCite syntax.
# Do not forget to document format change in Customization
# Manual (section "Declaring a new text class").
@ -451,7 +455,7 @@ def convert(lines, end_format):
i += 1
continue
if format >= 60 and format <= 61:
if format >= 60 and format <= 62:
# nothing to do.
i += 1
continue

View File

@ -62,7 +62,7 @@ namespace lyx {
// You should also run the development/tools/updatelayouts.py script,
// to update the format of all of our layout files.
//
int const LAYOUT_FORMAT = 62; //spitz PassThru for arguments.
int const LAYOUT_FORMAT = 63; //spitz: new tags CiteFramework, MaxCiteNames, extended InsetCite syntax.
// Layout format for the current lyx file format. Controls which format is
@ -155,7 +155,7 @@ TextClass::TextClass()
outputType_(LATEX), outputFormat_("latex"),
defaultfont_(sane_font),
titletype_(TITLE_COMMAND_AFTER), titlename_("maketitle"),
min_toclevel_(0), max_toclevel_(0),
min_toclevel_(0), max_toclevel_(0), maxcitenames_(2),
cite_full_author_list_(true)
{
}
@ -222,6 +222,7 @@ enum TextClassTags {
TC_CITEENGINETYPE,
TC_CITEFORMAT,
TC_CITEFRAMEWORK,
TC_MAXCITENAMES,
TC_DEFAULTBIBLIO,
TC_FULLAUTHORLIST,
TC_OUTLINERNAME
@ -256,6 +257,7 @@ LexerKeyword textClassTags[] = {
{ "input", TC_INPUT },
{ "insetlayout", TC_INSETLAYOUT },
{ "leftmargin", TC_LEFTMARGIN },
{ "maxcitenames", TC_MAXCITENAMES },
{ "modifystyle", TC_MODIFYSTYLE },
{ "nocounter", TC_NOCOUNTER },
{ "nofloat", TC_NOFLOAT },
@ -765,6 +767,11 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
citeframework_ = rtrim(lexrc.getString());
break;
case TC_MAXCITENAMES:
lexrc.next();
maxcitenames_ = size_t(lexrc.getInteger());
break;
case TC_DEFAULTBIBLIO:
if (lexrc.next()) {
vector<string> const dbs =

View File

@ -335,6 +335,8 @@ protected:
std::map<std::string, std::string> cite_default_biblio_style_;
/// Citation command aliases
std::map<std::string, std::string> cite_command_aliases_;
/// The maximum number of citations before "et al."
size_t maxcitenames_;
/// Whether full author lists are supported
bool cite_full_author_list_;
/// The possible citation styles
@ -498,6 +500,8 @@ public:
///
std::map<std::string, std::string> const & citeCommandAliases() const
{ return cite_command_aliases_; }
/// The maximum number of citations before "et al."
size_t max_citenames() const { return maxcitenames_; }
///
bool const & fullAuthorList() const { return cite_full_author_list_; }
protected: