commit d62a28ab1f97d736a24979cf4766ee1eb44d564c
Author: Juergen Spitzmueller <[email protected]>
Date: Sat Dec 31 19:44:32 2016 +0100
Add a CiteFramework tag
This is to distinguish the biblatex and bibtex paradigms
---
lib/citeengines/basic.citeengine | 3 ++-
lib/citeengines/jurabib.citeengine | 3 ++-
lib/citeengines/natbib.citeengine | 3 ++-
lib/configure.py | 13 +++++++++----
src/CiteEnginesList.cpp | 21 +++++++++++++--------
src/CiteEnginesList.h | 10 ++++++++--
src/TextClass.cpp | 7 +++++++
src/TextClass.h | 4 ++++
8 files changed, 47 insertions(+), 17 deletions(-)
diff --git a/lib/citeengines/basic.citeengine b/lib/citeengines/basic.citeengine
index 7de5e35..26d5ba3 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 <[email protected]>
Format 62
+CiteFramework bibtex
CiteEngineType default
DefaultBiblio plain
diff --git a/lib/citeengines/jurabib.citeengine
b/lib/citeengines/jurabib.citeengine
index de292bb..5c9192f 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 <[email protected]>
@@ -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 c738e51..98e5a10 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 <[email protected]>
@@ -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 fb5dcc6..43d3929 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 279063c..118c1b7 100644
--- a/src/CiteEnginesList.cpp
+++ b/src/CiteEnginesList.cpp
@@ -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";
@@ -245,6 +246,10 @@ bool CiteEnginesList::read()
}
if (!lex.next(true))
break;
+ string const citeframework = lex.getString();
+ LYXERR(Debug::TCLASS, "CiteFramework: " <<
citeframework);
+ if (!lex.next(true))
+ break;
string db = lex.getString();
LYXERR(Debug::TCLASS, "Default Biblio: " << db);
vector<string> dbs;
@@ -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);
}
diff --git a/src/CiteEnginesList.h b/src/CiteEnginesList.h
index f1fc04b..4226486 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<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_;
};
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index 73f3cd1..b6a5ad7 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<string> const dbs =
diff --git a/src/TextClass.h b/src/TextClass.h
index 3f83216..51bb417 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_; }