diff --git a/lib/citeengines/basic.citeengine b/lib/citeengines/basic.citeengine index 7de5e35d52..26d5ba379b 100644 --- a/lib/citeengines/basic.citeengine +++ b/lib/citeengines/basic.citeengine @@ -3,12 +3,13 @@ # The basic citation capabilities provided by BibTeX. # Mainly simple numeric styles primarily suitable for science and maths. # DescriptionEnd -# Excludes: jurabib | natbib +# Excludes: jurabib | natbib | biblatex # Author: Julien Rioux Format 62 +CiteFramework bibtex CiteEngineType default DefaultBiblio plain diff --git a/lib/citeengines/jurabib.citeengine b/lib/citeengines/jurabib.citeengine index de292bbe98..5c9192f75a 100644 --- a/lib/citeengines/jurabib.citeengine +++ b/lib/citeengines/jurabib.citeengine @@ -4,7 +4,7 @@ # and the Humanities. It includes localizations for English, German, French, Dutch, # Spanish and Italian. # DescriptionEnd -# Excludes: basic | natbib +# Excludes: basic | natbib | biblatex # Author: Julien Rioux @@ -12,6 +12,7 @@ Format 62 Requires jurabib +CiteFramework bibtex CiteEngineType authoryear DefaultBiblio jurabib diff --git a/lib/citeengines/natbib.citeengine b/lib/citeengines/natbib.citeengine index c738e513c8..98e5a10b0f 100644 --- a/lib/citeengines/natbib.citeengine +++ b/lib/citeengines/natbib.citeengine @@ -5,7 +5,7 @@ # numerical citations, annotations, capitalization of the `van' part of # author names, shortened and full author lists, and more. # DescriptionEnd -# Excludes: basic | jurabib +# Excludes: basic | jurabib | biblatex # Author: Julien Rioux @@ -13,6 +13,7 @@ Format 62 Requires natbib +CiteFramework bibtex CiteEngineType authoryear|numerical DefaultBiblio authoryear:plainnat|numerical:plainnat diff --git a/lib/configure.py b/lib/configure.py index fb5dcc6473..43d392978d 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -1511,7 +1511,7 @@ def checkCiteEnginesConfig(): ## It has been automatically generated by configure ## Use "Options/Reconfigure" if you need to update it after a ## configuration change. -## "CiteEngineName" "filename" "CiteEngineType" "DefaultBiblio" "Description" "Packages" "Requires" "Excludes" +## "CiteEngineName" "filename" "CiteEngineType" "CiteFramework" "DefaultBiblio" "Description" "Packages" "Requires" "Excludes" ''') # build the list of available modules @@ -1550,7 +1550,7 @@ def processCiteEngineFile(file, filename, bool_docbook): #Excludes: [list of excluded engines] The last two lines are optional. We expect output: - "CiteEngineName" "filename" "CiteEngineType" "DefaultBiblio" "Description" "Packages" "Requires" "Excludes" + "CiteEngineName" "filename" "CiteEngineType" "CiteFramework" "DefaultBiblio" "Description" "Packages" "Requires" "Excludes" ''' remods = re.compile(r'\DeclareLyXCiteEngine\s*(?:\[([^]]*?)\])?{(.*)}') rereqs = re.compile(r'#+\s*Requires:\s*(.*)') @@ -1559,8 +1559,9 @@ def processCiteEngineFile(file, filename, bool_docbook): redend = re.compile(r'#+\s*DescriptionEnd\s*$') recet = re.compile(r'\s*CiteEngineType\s*(.*)') redb = re.compile(r'\s*DefaultBiblio\s*(.*)') + resfm = re.compile(r'\s*CiteFramework\s*(.*)') - modname = desc = pkgs = req = excl = cet = db = "" + modname = desc = pkgs = req = excl = cet = db = cfm = "" readingDescription = False descLines = [] @@ -1608,6 +1609,10 @@ def processCiteEngineFile(file, filename, bool_docbook): if res != None: db = res.group(1) continue + res = resfm.search(line) + if res != None: + cfm = res.group(1) + continue if modname == "": logger.warning("Cite Engine File file without \DeclareLyXCiteEngine line. ") @@ -1630,7 +1635,7 @@ def processCiteEngineFile(file, filename, bool_docbook): cm.write(line + '\n') cm.close() - return '"%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s"\n' % (modname, filename, cet, db, desc, pkgs, req, excl) + return '"%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s"\n' % (modname, filename, cet, cfm, db, desc, pkgs, req, excl) def checkTeXAllowSpaces(): diff --git a/src/CiteEnginesList.cpp b/src/CiteEnginesList.cpp index 279063cafd..118c1b7a59 100644 --- a/src/CiteEnginesList.cpp +++ b/src/CiteEnginesList.cpp @@ -38,11 +38,12 @@ CiteEnginesList theCiteEnginesList; LyXCiteEngine::LyXCiteEngine(string const & n, string const & i, - vector const & cet, vector const & dbs, + vector const & cet, string const & cfm, + vector const & dbs, string const & d, vector const & p, vector const & r, vector const & e): - name_(n), id_(i), engine_types_(cet), default_biblios_(dbs), description_(d), - package_list_(p), required_engines_(r), excluded_engines_(e), + name_(n), id_(i), engine_types_(cet), cite_framework_(cfm), default_biblios_(dbs), + description_(d), package_list_(p), required_engines_(r), excluded_engines_(e), checked_(false), available_(false) { filename_ = id_ + ".citeengine"; @@ -243,6 +244,10 @@ bool CiteEnginesList::read() cet = split(cet, p, '|'); cets.push_back(p); } + if (!lex.next(true)) + break; + string const citeframework = lex.getString(); + LYXERR(Debug::TCLASS, "CiteFramework: " << citeframework); if (!lex.next(true)) break; string db = lex.getString(); @@ -290,7 +295,7 @@ bool CiteEnginesList::read() } // This code is run when we have // cename, fname, desc, pkgs, req and exc - addCiteEngine(cename, fname, cets, dbs, desc, pkgs, req, exc); + addCiteEngine(cename, fname, cets, citeframework, dbs, desc, pkgs, req, exc); } // end switch } //end while @@ -304,11 +309,11 @@ bool CiteEnginesList::read() void CiteEnginesList::addCiteEngine(string const & cename, string const & filename, vector const & cets, - vector const & dbs, string const & description, - vector const & pkgs, vector const & req, - vector const & exc) + string const & citeframework, vector const & dbs, + string const & description, vector const & pkgs, + vector const & req, vector const & exc) { - LyXCiteEngine ce(cename, filename, cets, dbs, description, pkgs, req, exc); + LyXCiteEngine ce(cename, filename, cets, citeframework, dbs, description, pkgs, req, exc); englist_.push_back(ce); } diff --git a/src/CiteEnginesList.h b/src/CiteEnginesList.h index f1fc04b442..42264863c5 100644 --- a/src/CiteEnginesList.h +++ b/src/CiteEnginesList.h @@ -51,6 +51,7 @@ public: /// LyXCiteEngine(std::string const & name, std::string const & id, std::vector const & enginetypes, + std::string const & cfm, std::vector const & defaultbiblios, std::string const & description, std::vector const & packagelist, @@ -67,6 +68,8 @@ public: /// std::string const & getFilename() const { return filename_; } /// + std::string const & getCiteFramework() const { return cite_framework_; } + /// std::vector const & getEngineType() const { return engine_types_; } /// bool hasEngineType(CiteEngineType const &) const; @@ -102,6 +105,8 @@ private: std::string filename_; /// the engine type(s) std::vector engine_types_; + /// cite framework (bibtex, biblatex) + std::string cite_framework_; /// default bibliography styles std::vector default_biblios_; /// a short description for use in the ui @@ -160,9 +165,10 @@ public: void operator=(CiteEnginesList const &); /// add an engine to the list void addCiteEngine(std::string const &, std::string const &, + std::vector const &, std::string const &, + std::vector const &, std::string const &, std::vector const &, std::vector const &, - std::string const &, std::vector const &, - std::vector const &, std::vector const &); + std::vector const &); /// std::vector englist_; }; diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 73f3cd194a..b6a5ad72b3 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -221,6 +221,7 @@ enum TextClassTags { TC_CITEENGINE, TC_CITEENGINETYPE, TC_CITEFORMAT, + TC_CITEFRAMEWORK, TC_DEFAULTBIBLIO, TC_FULLAUTHORLIST, TC_OUTLINERNAME @@ -236,6 +237,7 @@ LexerKeyword textClassTags[] = { { "citeengine", TC_CITEENGINE }, { "citeenginetype", TC_CITEENGINETYPE }, { "citeformat", TC_CITEFORMAT }, + { "citeframework", TC_CITEFRAMEWORK }, { "classoptions", TC_CLASSOPTIONS }, { "columns", TC_COLUMNS }, { "counter", TC_COUNTER }, @@ -758,6 +760,11 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt) error = !readCiteFormat(lexrc); break; + case TC_CITEFRAMEWORK: + lexrc.next(); + citeframework_ = rtrim(lexrc.getString()); + break; + case TC_DEFAULTBIBLIO: if (lexrc.next()) { vector const dbs = diff --git a/src/TextClass.h b/src/TextClass.h index 3f83216aaf..51bb417730 100644 --- a/src/TextClass.h +++ b/src/TextClass.h @@ -258,6 +258,8 @@ protected: mutable std::string prerequisites_; /// The possible cite engine types std::string opt_enginetype_; + /// The cite framework (bibtex, biblatex) + std::string citeframework_; /// std::string opt_fontsize_; /// @@ -421,6 +423,8 @@ public: /// std::string const & opt_enginetype() const { return opt_enginetype_; } /// + std::string const & citeFramework() const { return citeframework_; } + /// std::string const & opt_fontsize() const { return opt_fontsize_; } /// std::string const & opt_pagestyle() const { return opt_pagestyle_; }