mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +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.
|
# 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 | biblatex | biblatex-natbib
|
|
||||||
|
|
||||||
# Author: Julien Rioux <jrioux@lyx.org>
|
# Author: Julien Rioux <jrioux@lyx.org>
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
# than normal Biblatex. As with normal Biblatex, the use of 'biber'
|
# than normal Biblatex. As with normal Biblatex, the use of 'biber'
|
||||||
# as Bibliography processor is advised.
|
# as Bibliography processor is advised.
|
||||||
# DescriptionEnd
|
# DescriptionEnd
|
||||||
# Excludes: basic | jurabib | biblatex | natbib
|
|
||||||
|
|
||||||
# Author: Jürgen Spitzmüller <spitz@lyx.org>
|
# Author: Jürgen Spitzmüller <spitz@lyx.org>
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
# and provides many features that are not possible with BibTeX.
|
# and provides many features that are not possible with BibTeX.
|
||||||
# The use of 'biber' as bibliography processor is advised.
|
# The use of 'biber' as bibliography processor is advised.
|
||||||
# DescriptionEnd
|
# DescriptionEnd
|
||||||
# Excludes: basic | jurabib | natbib | biblatex-natbib
|
|
||||||
|
|
||||||
# Author: Jürgen Spitzmüller <spitz@lyx.org>
|
# Author: Jürgen Spitzmüller <spitz@lyx.org>
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
# 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 | biblatex | biblatex-natbib
|
|
||||||
|
|
||||||
# Author: Julien Rioux <jrioux@lyx.org>
|
# Author: Julien Rioux <jrioux@lyx.org>
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
# 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 | biblatex | biblatex-natbib
|
|
||||||
|
|
||||||
# Author: Julien Rioux <jrioux@lyx.org>
|
# Author: Julien Rioux <jrioux@lyx.org>
|
||||||
|
|
||||||
|
@ -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" "CiteFramework" "DefaultBiblio" "Description" "Packages" "Requires" "Excludes"
|
## "CiteEngineName" "filename" "CiteEngineType" "CiteFramework" "DefaultBiblio" "Description" "Packages"
|
||||||
''')
|
''')
|
||||||
|
|
||||||
# build the list of available modules
|
# build the list of available modules
|
||||||
@ -1546,22 +1546,17 @@ def processCiteEngineFile(file, filename, bool_docbook):
|
|||||||
#DescriptionBegin
|
#DescriptionBegin
|
||||||
#...body of description...
|
#...body of description...
|
||||||
#DescriptionEnd
|
#DescriptionEnd
|
||||||
#Requires: [list of required engines]
|
|
||||||
#Excludes: [list of excluded engines]
|
|
||||||
The last two lines are optional.
|
|
||||||
We expect output:
|
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*(?:\[([^]]*?)\])?{(.*)}')
|
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*$')
|
redbeg = re.compile(r'#+\s*DescriptionBegin\s*$')
|
||||||
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*(.*)')
|
resfm = re.compile(r'\s*CiteFramework\s*(.*)')
|
||||||
|
|
||||||
modname = desc = pkgs = req = excl = cet = db = cfm = ""
|
modname = desc = pkgs = cet = db = cfm = ""
|
||||||
readingDescription = False
|
readingDescription = False
|
||||||
descLines = []
|
descLines = []
|
||||||
|
|
||||||
@ -1589,18 +1584,6 @@ def processCiteEngineFile(file, filename, bool_docbook):
|
|||||||
tmp = [s.strip() for s in pkgs.split(",")]
|
tmp = [s.strip() for s in pkgs.split(",")]
|
||||||
pkgs = ",".join(tmp)
|
pkgs = ",".join(tmp)
|
||||||
continue
|
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)
|
res = recet.search(line)
|
||||||
if res != None:
|
if res != None:
|
||||||
cet = res.group(1)
|
cet = res.group(1)
|
||||||
@ -1635,7 +1618,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" "%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():
|
def checkTeXAllowSpaces():
|
||||||
|
@ -40,11 +40,9 @@ CiteEnginesList theCiteEnginesList;
|
|||||||
LyXCiteEngine::LyXCiteEngine(string const & n, string const & i,
|
LyXCiteEngine::LyXCiteEngine(string const & n, string const & i,
|
||||||
vector<string> const & cet, string const & cfm,
|
vector<string> const & cet, string const & cfm,
|
||||||
vector<string> const & dbs,
|
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):
|
|
||||||
name_(n), id_(i), engine_types_(cet), cite_framework_(cfm), default_biblios_(dbs),
|
name_(n), id_(i), engine_types_(cet), cite_framework_(cfm), default_biblios_(dbs),
|
||||||
description_(d), package_list_(p), required_engines_(r), excluded_engines_(e),
|
description_(d), package_list_(p), checked_(false), available_(false)
|
||||||
checked_(false), available_(false)
|
|
||||||
{
|
{
|
||||||
filename_ = id_ + ".citeengine";
|
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 LyXCiteEngine::getDefaultBiblio(CiteEngineType const & cet) const
|
||||||
{
|
{
|
||||||
string res;
|
string res;
|
||||||
@ -273,29 +238,9 @@ bool CiteEnginesList::read()
|
|||||||
str = split(str, p, ',');
|
str = split(str, p, ',');
|
||||||
pkgs.push_back(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
|
// This code is run when we have
|
||||||
// cename, fname, desc, pkgs, req and exc
|
// cename, fname, cets, citeframework, dbs, desc, pkgs
|
||||||
addCiteEngine(cename, fname, cets, citeframework, dbs, desc, pkgs, req, exc);
|
addCiteEngine(cename, fname, cets, citeframework, dbs, desc, pkgs);
|
||||||
} // end switch
|
} // end switch
|
||||||
} //end while
|
} //end while
|
||||||
|
|
||||||
@ -310,10 +255,9 @@ 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,
|
||||||
string const & citeframework, vector<string> const & dbs,
|
string const & citeframework, vector<string> const & dbs,
|
||||||
string const & description, vector<string> const & pkgs,
|
string const & description, vector<string> const & pkgs)
|
||||||
vector<string> const & req, vector<string> const & exc)
|
|
||||||
{
|
{
|
||||||
LyXCiteEngine ce(cename, filename, cets, citeframework, dbs, description, pkgs, req, exc);
|
LyXCiteEngine ce(cename, filename, cets, citeframework, dbs, description, pkgs);
|
||||||
englist_.push_back(ce);
|
englist_.push_back(ce);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,9 +54,7 @@ public:
|
|||||||
std::string const & cfm,
|
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);
|
||||||
std::vector<std::string> const & requires,
|
|
||||||
std::vector<std::string> const & excludes);
|
|
||||||
/// whether the required packages are available
|
/// whether the required packages are available
|
||||||
bool isAvailable() const;
|
bool isAvailable() const;
|
||||||
/// the missing prerequisites, if any
|
/// the missing prerequisites, if any
|
||||||
@ -82,19 +80,6 @@ public:
|
|||||||
///
|
///
|
||||||
std::vector<std::string> const & getPackageList() const
|
std::vector<std::string> const & getPackageList() const
|
||||||
{ return package_list_; }
|
{ 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:
|
private:
|
||||||
/// what appears in the ui
|
/// what appears in the ui
|
||||||
std::string name_;
|
std::string name_;
|
||||||
@ -113,10 +98,6 @@ private:
|
|||||||
std::string description_;
|
std::string description_;
|
||||||
/// the LaTeX packages on which this depends, if any
|
/// the LaTeX packages on which this depends, if any
|
||||||
std::vector<std::string> package_list_;
|
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
|
// these are mutable because they are used to cache the results
|
||||||
// or an otherwise const operation.
|
// or an otherwise const operation.
|
||||||
///
|
///
|
||||||
@ -167,7 +148,6 @@ public:
|
|||||||
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::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_;
|
||||||
|
Loading…
Reference in New Issue
Block a user