commit 979294d5ecd91f8831db234738f9e769966b391f
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Sat Jan 7 16:44:27 2017 +0100

    New tag MaxCiteNames
    
    This determines the number of authors before "et al.". We had it
    hardcoded to 2, but actually the nuumber differs.
---
 lib/citeengines/basic.citeengine   |    2 +-
 lib/citeengines/jurabib.citeengine |    5 ++++-
 lib/citeengines/natbib.citeengine  |    5 ++++-
 lib/scripts/layout2layout.py       |    8 ++++++--
 src/TextClass.cpp                  |   11 +++++++++--
 src/TextClass.h                    |    4 ++++
 6 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/lib/citeengines/basic.citeengine b/lib/citeengines/basic.citeengine
index e16d466..a850f07 100644
--- a/lib/citeengines/basic.citeengine
+++ b/lib/citeengines/basic.citeengine
@@ -7,7 +7,7 @@
 
 # Author: Julien Rioux <jri...@lyx.org>
 
-Format 62
+Format 63
 
 # The framework (biblatex|bibtex)
 CiteFramework bibtex
diff --git a/lib/citeengines/jurabib.citeengine 
b/lib/citeengines/jurabib.citeengine
index c0c5b97..50c74bd 100644
--- a/lib/citeengines/jurabib.citeengine
+++ b/lib/citeengines/jurabib.citeengine
@@ -8,7 +8,7 @@
 
 # Author: Julien Rioux <jri...@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
diff --git a/lib/citeengines/natbib.citeengine 
b/lib/citeengines/natbib.citeengine
index ca6c8b8..0eee3cc 100644
--- a/lib/citeengines/natbib.citeengine
+++ b/lib/citeengines/natbib.citeengine
@@ -9,7 +9,7 @@
 
 # Author: Julien Rioux <jri...@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
diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py
index c0829e6..d932700 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 9e71e1c..9a51fb0 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<string> const dbs =
diff --git a/src/TextClass.h b/src/TextClass.h
index 319ea96..dbfb974 100644
--- a/src/TextClass.h
+++ b/src/TextClass.h
@@ -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:

Reply via email to