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 c72ecbcd1b
commit dc9efe3d47
8 changed files with 47 additions and 17 deletions

View File

@ -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 <jrioux@lyx.org>
Format 62
CiteFramework bibtex
CiteEngineType default
DefaultBiblio plain

View File

@ -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 <jrioux@lyx.org>
@ -12,6 +12,7 @@ Format 62
Requires jurabib
CiteFramework bibtex
CiteEngineType authoryear
DefaultBiblio jurabib

View File

@ -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 <jrioux@lyx.org>
@ -13,6 +13,7 @@ Format 62
Requires natbib
CiteFramework bibtex
CiteEngineType authoryear|numerical
DefaultBiblio authoryear:plainnat|numerical:plainnat

View File

@ -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():

View File

@ -38,11 +38,12 @@ CiteEnginesList theCiteEnginesList;
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,
vector<string> const & r, vector<string> 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<string> const & cets,
vector<string> const & dbs, string const & description,
vector<string> const & pkgs, vector<string> const & req,
vector<string> const & exc)
string const & citeframework, vector<string> const & dbs,
string const & description, vector<string> const & pkgs,
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);
}

View File

@ -51,6 +51,7 @@ public:
///
LyXCiteEngine(std::string const & name, std::string const & id,
std::vector<std::string> const & enginetypes,
std::string const & cfm,
std::vector<std::string> const & defaultbiblios,
std::string const & description,
std::vector<std::string> const & packagelist,
@ -67,6 +68,8 @@ public:
///
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_; }
///
bool hasEngineType(CiteEngineType const &) const;
@ -102,6 +105,8 @@ private:
std::string filename_;
/// the engine type(s)
std::vector<std::string> engine_types_;
/// cite framework (bibtex, biblatex)
std::string cite_framework_;
/// default bibliography styles
std::vector<std::string> 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<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::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_;
};

View File

@ -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<string> const dbs =

View File

@ -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_; }