From: Juergen Spitzmueller Date: Sat, 7 Jan 2017 15:44:27 +0000 (+0100) Subject: New tag MaxCiteNames X-Git-Tag: 2.3.0alpha1~516 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=979294d5ecd91f8831db234738f9e769966b391f;hp=23c231c761dda80d220927c15e15c14493a57bc2;p=features.git New tag MaxCiteNames This determines the number of authors before "et al.". We had it hardcoded to 2, but actually the nuumber differs. --- diff --git a/lib/citeengines/basic.citeengine b/lib/citeengines/basic.citeengine index e16d466b1d..a850f07f98 100644 --- a/lib/citeengines/basic.citeengine +++ b/lib/citeengines/basic.citeengine @@ -7,7 +7,7 @@ # Author: Julien Rioux -Format 62 +Format 63 # The framework (biblatex|bibtex) CiteFramework bibtex diff --git a/lib/citeengines/jurabib.citeengine b/lib/citeengines/jurabib.citeengine index c0c5b9748a..50c74bdb05 100644 --- a/lib/citeengines/jurabib.citeengine +++ b/lib/citeengines/jurabib.citeengine @@ -8,7 +8,7 @@ # Author: Julien Rioux -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*[][]=latexcmd diff --git a/lib/citeengines/natbib.citeengine b/lib/citeengines/natbib.citeengine index ca6c8b829f..0eee3cc840 100644 --- a/lib/citeengines/natbib.citeengine +++ b/lib/citeengines/natbib.citeengine @@ -9,7 +9,7 @@ # Author: Julien Rioux -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*[][]=latexcmd diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py index c0829e6cd4..d932700bb4 100644 --- a/lib/scripts/layout2layout.py +++ b/lib/scripts/layout2layout.py @@ -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 diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 9e71e1c9a7..9a51fb0d09 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -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 const dbs = diff --git a/src/TextClass.h b/src/TextClass.h index 319ea96bd8..dbfb97436e 100644 --- a/src/TextClass.h +++ b/src/TextClass.h @@ -335,6 +335,8 @@ protected: std::map cite_default_biblio_style_; /// Citation command aliases std::map 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 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: