Add a CiteFramework tag

This is to distinguish the biblatex and bibtex paradigms
This commit is contained in:
Juergen Spitzmueller 2016-12-31 19:44:32 +01:00
parent 297eb4cd5c
commit d62a28ab1f
8 changed files with 47 additions and 17 deletions

View File

@ -3,12 +3,13 @@
# The basic citation capabilities provided by BibTeX. # The basic citation capabilities provided by BibTeX.
# Mainly simple numeric styles primarily suitable for science and maths. # Mainly simple numeric styles primarily suitable for science and maths.
# DescriptionEnd # DescriptionEnd
# Excludes: jurabib | natbib # Excludes: jurabib | natbib | biblatex
# Author: Julien Rioux <jrioux@lyx.org> # Author: Julien Rioux <jrioux@lyx.org>
Format 62 Format 62
CiteFramework bibtex
CiteEngineType default CiteEngineType default
DefaultBiblio plain DefaultBiblio plain

View File

@ -4,7 +4,7 @@
# and the Humanities. It includes localizations for English, German, French, Dutch, # and the Humanities. It includes localizations for English, German, French, Dutch,
# Spanish and Italian. # Spanish and Italian.
# DescriptionEnd # DescriptionEnd
# Excludes: basic | natbib # Excludes: basic | natbib | biblatex
# Author: Julien Rioux <jrioux@lyx.org> # Author: Julien Rioux <jrioux@lyx.org>
@ -12,6 +12,7 @@ Format 62
Requires jurabib Requires jurabib
CiteFramework bibtex
CiteEngineType authoryear CiteEngineType authoryear
DefaultBiblio jurabib DefaultBiblio jurabib

View File

@ -5,7 +5,7 @@
# numerical citations, annotations, capitalization of the `van' part of # numerical citations, annotations, capitalization of the `van' part of
# author names, shortened and full author lists, and more. # author names, shortened and full author lists, and more.
# DescriptionEnd # DescriptionEnd
# Excludes: basic | jurabib # Excludes: basic | jurabib | biblatex
# Author: Julien Rioux <jrioux@lyx.org> # Author: Julien Rioux <jrioux@lyx.org>
@ -13,6 +13,7 @@ Format 62
Requires natbib Requires natbib
CiteFramework bibtex
CiteEngineType authoryear|numerical CiteEngineType authoryear|numerical
DefaultBiblio authoryear:plainnat|numerical:plainnat DefaultBiblio authoryear:plainnat|numerical:plainnat

View File

@ -1511,7 +1511,7 @@ def checkCiteEnginesConfig():
## It has been automatically generated by configure ## It has been automatically generated by configure
## Use "Options/Reconfigure" if you need to update it after a ## Use "Options/Reconfigure" if you need to update it after a
## configuration change. ## 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 # build the list of available modules
@ -1550,7 +1550,7 @@ def processCiteEngineFile(file, filename, bool_docbook):
#Excludes: [list of excluded engines] #Excludes: [list of excluded engines]
The last two lines are optional. The last two lines are optional.
We expect output: 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*(?:\[([^]]*?)\])?{(.*)}') remods = re.compile(r'\DeclareLyXCiteEngine\s*(?:\[([^]]*?)\])?{(.*)}')
rereqs = re.compile(r'#+\s*Requires:\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*$') redend = re.compile(r'#+\s*DescriptionEnd\s*$')
recet = re.compile(r'\s*CiteEngineType\s*(.*)') recet = re.compile(r'\s*CiteEngineType\s*(.*)')
redb = re.compile(r'\s*DefaultBiblio\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 readingDescription = False
descLines = [] descLines = []
@ -1608,6 +1609,10 @@ def processCiteEngineFile(file, filename, bool_docbook):
if res != None: if res != None:
db = res.group(1) db = res.group(1)
continue continue
res = resfm.search(line)
if res != None:
cfm = res.group(1)
continue
if modname == "": if modname == "":
logger.warning("Cite Engine File file without \DeclareLyXCiteEngine line. ") logger.warning("Cite Engine File file without \DeclareLyXCiteEngine line. ")
@ -1630,7 +1635,7 @@ def processCiteEngineFile(file, filename, bool_docbook):
cm.write(line + '\n') cm.write(line + '\n')
cm.close() 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(): def checkTeXAllowSpaces():

View File

@ -38,11 +38,12 @@ CiteEnginesList theCiteEnginesList;
LyXCiteEngine::LyXCiteEngine(string const & n, string const & i, LyXCiteEngine::LyXCiteEngine(string const & n, string const & i,
vector<string> const & cet, vector<string> const & dbs, vector<string> const & cet, string const & cfm,
vector<string> const & dbs,
string const & d, vector<string> const & p, string const & d, vector<string> const & p,
vector<string> const & r, vector<string> const & e): vector<string> const & r, vector<string> const & e):
name_(n), id_(i), engine_types_(cet), default_biblios_(dbs), description_(d), name_(n), id_(i), engine_types_(cet), cite_framework_(cfm), default_biblios_(dbs),
package_list_(p), required_engines_(r), excluded_engines_(e), description_(d), package_list_(p), required_engines_(r), excluded_engines_(e),
checked_(false), available_(false) checked_(false), available_(false)
{ {
filename_ = id_ + ".citeengine"; filename_ = id_ + ".citeengine";
@ -243,6 +244,10 @@ bool CiteEnginesList::read()
cet = split(cet, p, '|'); cet = split(cet, p, '|');
cets.push_back(p); cets.push_back(p);
} }
if (!lex.next(true))
break;
string const citeframework = lex.getString();
LYXERR(Debug::TCLASS, "CiteFramework: " << citeframework);
if (!lex.next(true)) if (!lex.next(true))
break; break;
string db = lex.getString(); string db = lex.getString();
@ -290,7 +295,7 @@ bool CiteEnginesList::read()
} }
// This code is run when we have // This code is run when we have
// cename, fname, desc, pkgs, req and exc // 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 switch
} //end while } //end while
@ -304,11 +309,11 @@ bool CiteEnginesList::read()
void CiteEnginesList::addCiteEngine(string const & cename, void CiteEnginesList::addCiteEngine(string const & cename,
string const & filename, vector<string> const & cets, string const & filename, vector<string> const & cets,
vector<string> const & dbs, string const & description, string const & citeframework, vector<string> const & dbs,
vector<string> const & pkgs, vector<string> const & req, string const & description, vector<string> const & pkgs,
vector<string> const & exc) vector<string> const & req, vector<string> 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); englist_.push_back(ce);
} }

View File

@ -51,6 +51,7 @@ public:
/// ///
LyXCiteEngine(std::string const & name, std::string const & id, LyXCiteEngine(std::string const & name, std::string const & id,
std::vector<std::string> const & enginetypes, std::vector<std::string> const & enginetypes,
std::string const & cfm,
std::vector<std::string> const & defaultbiblios, std::vector<std::string> const & defaultbiblios,
std::string const & description, std::string const & description,
std::vector<std::string> const & packagelist, std::vector<std::string> const & packagelist,
@ -67,6 +68,8 @@ public:
/// ///
std::string const & getFilename() const { return filename_; } std::string const & getFilename() const { return filename_; }
/// ///
std::string const & getCiteFramework() const { return cite_framework_; }
///
std::vector<std::string> const & getEngineType() const { return engine_types_; } std::vector<std::string> const & getEngineType() const { return engine_types_; }
/// ///
bool hasEngineType(CiteEngineType const &) const; bool hasEngineType(CiteEngineType const &) const;
@ -102,6 +105,8 @@ private:
std::string filename_; std::string filename_;
/// the engine type(s) /// the engine type(s)
std::vector<std::string> engine_types_; std::vector<std::string> engine_types_;
/// cite framework (bibtex, biblatex)
std::string cite_framework_;
/// default bibliography styles /// default bibliography styles
std::vector<std::string> default_biblios_; std::vector<std::string> default_biblios_;
/// a short description for use in the ui /// a short description for use in the ui
@ -160,9 +165,10 @@ public:
void operator=(CiteEnginesList const &); void operator=(CiteEnginesList const &);
/// add an engine to the list /// add an engine to the list
void addCiteEngine(std::string const &, std::string const &, void addCiteEngine(std::string const &, std::string const &,
std::vector<std::string> const &, std::string const &,
std::vector<std::string> const &, std::string const &,
std::vector<std::string> const &, std::vector<std::string> const &, std::vector<std::string> const &, std::vector<std::string> const &,
std::string const &, std::vector<std::string> const &, std::vector<std::string> const &);
std::vector<std::string> const &, std::vector<std::string> const &);
/// ///
std::vector<LyXCiteEngine> englist_; std::vector<LyXCiteEngine> englist_;
}; };

View File

@ -221,6 +221,7 @@ enum TextClassTags {
TC_CITEENGINE, TC_CITEENGINE,
TC_CITEENGINETYPE, TC_CITEENGINETYPE,
TC_CITEFORMAT, TC_CITEFORMAT,
TC_CITEFRAMEWORK,
TC_DEFAULTBIBLIO, TC_DEFAULTBIBLIO,
TC_FULLAUTHORLIST, TC_FULLAUTHORLIST,
TC_OUTLINERNAME TC_OUTLINERNAME
@ -236,6 +237,7 @@ LexerKeyword textClassTags[] = {
{ "citeengine", TC_CITEENGINE }, { "citeengine", TC_CITEENGINE },
{ "citeenginetype", TC_CITEENGINETYPE }, { "citeenginetype", TC_CITEENGINETYPE },
{ "citeformat", TC_CITEFORMAT }, { "citeformat", TC_CITEFORMAT },
{ "citeframework", TC_CITEFRAMEWORK },
{ "classoptions", TC_CLASSOPTIONS }, { "classoptions", TC_CLASSOPTIONS },
{ "columns", TC_COLUMNS }, { "columns", TC_COLUMNS },
{ "counter", TC_COUNTER }, { "counter", TC_COUNTER },
@ -758,6 +760,11 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt)
error = !readCiteFormat(lexrc); error = !readCiteFormat(lexrc);
break; break;
case TC_CITEFRAMEWORK:
lexrc.next();
citeframework_ = rtrim(lexrc.getString());
break;
case TC_DEFAULTBIBLIO: case TC_DEFAULTBIBLIO:
if (lexrc.next()) { if (lexrc.next()) {
vector<string> const dbs = vector<string> const dbs =

View File

@ -258,6 +258,8 @@ protected:
mutable std::string prerequisites_; mutable std::string prerequisites_;
/// The possible cite engine types /// The possible cite engine types
std::string opt_enginetype_; std::string opt_enginetype_;
/// The cite framework (bibtex, biblatex)
std::string citeframework_;
/// ///
std::string opt_fontsize_; std::string opt_fontsize_;
/// ///
@ -421,6 +423,8 @@ public:
/// ///
std::string const & opt_enginetype() const { return opt_enginetype_; } 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_fontsize() const { return opt_fontsize_; }
/// ///
std::string const & opt_pagestyle() const { return opt_pagestyle_; } std::string const & opt_pagestyle() const { return opt_pagestyle_; }