mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Remove Requires and Excludes from CiteEngines
These are exclusive anyway.
This commit is contained in:
parent
352a8e115f
commit
a04a2f9a8a
@ -3,7 +3,6 @@
|
||||
# The basic citation capabilities provided by BibTeX.
|
||||
# Mainly simple numeric styles primarily suitable for science and maths.
|
||||
# DescriptionEnd
|
||||
# Excludes: jurabib | natbib | biblatex | biblatex-natbib
|
||||
|
||||
# Author: Julien Rioux <jrioux@lyx.org>
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
# than normal Biblatex. As with normal Biblatex, the use of 'biber'
|
||||
# as Bibliography processor is advised.
|
||||
# DescriptionEnd
|
||||
# Excludes: basic | jurabib | biblatex | natbib
|
||||
|
||||
# Author: Jürgen Spitzmüller <spitz@lyx.org>
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
# and provides many features that are not possible with BibTeX.
|
||||
# The use of 'biber' as bibliography processor is advised.
|
||||
# DescriptionEnd
|
||||
# Excludes: basic | jurabib | natbib | biblatex-natbib
|
||||
|
||||
# Author: Jürgen Spitzmüller <spitz@lyx.org>
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
# and the Humanities. It includes localizations for English, German, French, Dutch,
|
||||
# Spanish and Italian.
|
||||
# DescriptionEnd
|
||||
# Excludes: basic | natbib | biblatex | biblatex-natbib
|
||||
|
||||
# Author: Julien Rioux <jrioux@lyx.org>
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
# numerical citations, annotations, capitalization of the `van' part of
|
||||
# author names, shortened and full author lists, and more.
|
||||
# DescriptionEnd
|
||||
# Excludes: basic | jurabib | biblatex | biblatex-natbib
|
||||
|
||||
# Author: Julien Rioux <jrioux@lyx.org>
|
||||
|
||||
|
@ -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" "CiteFramework" "DefaultBiblio" "Description" "Packages" "Requires" "Excludes"
|
||||
## "CiteEngineName" "filename" "CiteEngineType" "CiteFramework" "DefaultBiblio" "Description" "Packages"
|
||||
''')
|
||||
|
||||
# build the list of available modules
|
||||
@ -1546,22 +1546,17 @@ def processCiteEngineFile(file, filename, bool_docbook):
|
||||
#DescriptionBegin
|
||||
#...body of description...
|
||||
#DescriptionEnd
|
||||
#Requires: [list of required engines]
|
||||
#Excludes: [list of excluded engines]
|
||||
The last two lines are optional.
|
||||
We expect output:
|
||||
"CiteEngineName" "filename" "CiteEngineType" "CiteFramework" "DefaultBiblio" "Description" "Packages" "Requires" "Excludes"
|
||||
"CiteEngineName" "filename" "CiteEngineType" "CiteFramework" "DefaultBiblio" "Description" "Packages"
|
||||
'''
|
||||
remods = re.compile(r'\DeclareLyXCiteEngine\s*(?:\[([^]]*?)\])?{(.*)}')
|
||||
rereqs = re.compile(r'#+\s*Requires:\s*(.*)')
|
||||
reexcs = re.compile(r'#+\s*Excludes:\s*(.*)')
|
||||
redbeg = re.compile(r'#+\s*DescriptionBegin\s*$')
|
||||
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 = cfm = ""
|
||||
modname = desc = pkgs = cet = db = cfm = ""
|
||||
readingDescription = False
|
||||
descLines = []
|
||||
|
||||
@ -1589,18 +1584,6 @@ def processCiteEngineFile(file, filename, bool_docbook):
|
||||
tmp = [s.strip() for s in pkgs.split(",")]
|
||||
pkgs = ",".join(tmp)
|
||||
continue
|
||||
res = rereqs.search(line)
|
||||
if res != None:
|
||||
req = res.group(1)
|
||||
tmp = [s.strip() for s in req.split("|")]
|
||||
req = "|".join(tmp)
|
||||
continue
|
||||
res = reexcs.search(line)
|
||||
if res != None:
|
||||
excl = res.group(1)
|
||||
tmp = [s.strip() for s in excl.split("|")]
|
||||
excl = "|".join(tmp)
|
||||
continue
|
||||
res = recet.search(line)
|
||||
if res != None:
|
||||
cet = res.group(1)
|
||||
@ -1635,7 +1618,7 @@ def processCiteEngineFile(file, filename, bool_docbook):
|
||||
cm.write(line + '\n')
|
||||
cm.close()
|
||||
|
||||
return '"%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s"\n' % (modname, filename, cet, cfm, db, desc, pkgs, req, excl)
|
||||
return '"%s" "%s" "%s" "%s" "%s" "%s" "%s"\n' % (modname, filename, cet, cfm, db, desc, pkgs)
|
||||
|
||||
|
||||
def checkTeXAllowSpaces():
|
||||
|
@ -40,11 +40,9 @@ CiteEnginesList theCiteEnginesList;
|
||||
LyXCiteEngine::LyXCiteEngine(string const & n, string const & i,
|
||||
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):
|
||||
string const & d, vector<string> const & p):
|
||||
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)
|
||||
description_(d), package_list_(p), checked_(false), available_(false)
|
||||
{
|
||||
filename_ = id_ + ".citeengine";
|
||||
}
|
||||
@ -86,39 +84,6 @@ bool LyXCiteEngine::hasEngineType(CiteEngineType const & et) const
|
||||
}
|
||||
|
||||
|
||||
bool LyXCiteEngine::isCompatible(string const & cename) const
|
||||
{
|
||||
// do we exclude it?
|
||||
if (find(excluded_engines_.begin(), excluded_engines_.end(), cename) !=
|
||||
excluded_engines_.end())
|
||||
return false;
|
||||
|
||||
LyXCiteEngine const * const lm = theCiteEnginesList[cename];
|
||||
if (!lm)
|
||||
return true;
|
||||
|
||||
// does it exclude us?
|
||||
vector<string> const excengs = lm->getExcludedEngines();
|
||||
if (find(excengs.begin(), excengs.end(), id_) != excengs.end())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool LyXCiteEngine::areCompatible(string const & eng1, string const & eng2)
|
||||
{
|
||||
LyXCiteEngine const * const lm1 = theCiteEnginesList[eng1];
|
||||
if (lm1)
|
||||
return lm1->isCompatible(eng2);
|
||||
LyXCiteEngine const * const lm2 = theCiteEnginesList[eng2];
|
||||
if (lm2)
|
||||
return lm2->isCompatible(eng1);
|
||||
// Can't check it either way.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
string LyXCiteEngine::getDefaultBiblio(CiteEngineType const & cet) const
|
||||
{
|
||||
string res;
|
||||
@ -273,29 +238,9 @@ bool CiteEnginesList::read()
|
||||
str = split(str, p, ',');
|
||||
pkgs.push_back(p);
|
||||
}
|
||||
if (!lex.next())
|
||||
break;
|
||||
str = lex.getString();
|
||||
LYXERR(Debug::TCLASS, "Required: " << str);
|
||||
vector<string> req;
|
||||
while (!str.empty()) {
|
||||
string p;
|
||||
str = split(str, p, '|');
|
||||
req.push_back(p);
|
||||
}
|
||||
if (!lex.next())
|
||||
break;
|
||||
str = lex.getString();
|
||||
LYXERR(Debug::TCLASS, "Excluded: " << str);
|
||||
vector<string> exc;
|
||||
while (!str.empty()) {
|
||||
string p;
|
||||
str = split(str, p, '|');
|
||||
exc.push_back(p);
|
||||
}
|
||||
// This code is run when we have
|
||||
// cename, fname, desc, pkgs, req and exc
|
||||
addCiteEngine(cename, fname, cets, citeframework, dbs, desc, pkgs, req, exc);
|
||||
// cename, fname, cets, citeframework, dbs, desc, pkgs
|
||||
addCiteEngine(cename, fname, cets, citeframework, dbs, desc, pkgs);
|
||||
} // end switch
|
||||
} //end while
|
||||
|
||||
@ -310,10 +255,9 @@ bool CiteEnginesList::read()
|
||||
void CiteEnginesList::addCiteEngine(string const & cename,
|
||||
string const & filename, vector<string> const & cets,
|
||||
string const & citeframework, vector<string> const & dbs,
|
||||
string const & description, vector<string> const & pkgs,
|
||||
vector<string> const & req, vector<string> const & exc)
|
||||
string const & description, vector<string> const & pkgs)
|
||||
{
|
||||
LyXCiteEngine ce(cename, filename, cets, citeframework, dbs, description, pkgs, req, exc);
|
||||
LyXCiteEngine ce(cename, filename, cets, citeframework, dbs, description, pkgs);
|
||||
englist_.push_back(ce);
|
||||
}
|
||||
|
||||
|
@ -54,9 +54,7 @@ public:
|
||||
std::string const & cfm,
|
||||
std::vector<std::string> const & defaultbiblios,
|
||||
std::string const & description,
|
||||
std::vector<std::string> const & packagelist,
|
||||
std::vector<std::string> const & requires,
|
||||
std::vector<std::string> const & excludes);
|
||||
std::vector<std::string> const & packagelist);
|
||||
/// whether the required packages are available
|
||||
bool isAvailable() const;
|
||||
/// the missing prerequisites, if any
|
||||
@ -82,19 +80,6 @@ public:
|
||||
///
|
||||
std::vector<std::string> const & getPackageList() const
|
||||
{ return package_list_; }
|
||||
///
|
||||
std::vector<std::string> const & getRequiredEngines() const
|
||||
{ return required_engines_; }
|
||||
/// Engines this one excludes: the list should be treated disjunctively
|
||||
std::vector<std::string> const & getExcludedEngines() const
|
||||
{ return excluded_engines_; }
|
||||
/// \return true if the engine is compatible with this one, i.e.,
|
||||
/// it does not exclude us and we do not exclude it.
|
||||
/// this will also return true if cename is unknown and we do not
|
||||
/// exclude it, since in that case we cannot check its exclusions.
|
||||
bool isCompatible(std::string const & cename) const;
|
||||
///
|
||||
static bool areCompatible(std::string const & eng1, std::string const & eng2);
|
||||
private:
|
||||
/// what appears in the ui
|
||||
std::string name_;
|
||||
@ -113,10 +98,6 @@ private:
|
||||
std::string description_;
|
||||
/// the LaTeX packages on which this depends, if any
|
||||
std::vector<std::string> package_list_;
|
||||
/// Engines this one requires: at least one
|
||||
std::vector<std::string> required_engines_;
|
||||
/// Engines this one excludes: none of these
|
||||
std::vector<std::string> excluded_engines_;
|
||||
// these are mutable because they are used to cache the results
|
||||
// or an otherwise const operation.
|
||||
///
|
||||
@ -167,7 +148,6 @@ public:
|
||||
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<LyXCiteEngine> englist_;
|
||||
|
Loading…
Reference in New Issue
Block a user