Multiple external requirements

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9780 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Martin Vermeer 2005-04-05 11:00:09 +00:00
parent e9ac548c9a
commit 958bd96f53
4 changed files with 21 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2005-04-05 Martin Vermeer <martin.vermeer@hut.fi>
* insetexternal.C (validate):
* ExternalTemplate.[Ch] (dumpFormat, readFormat): allow
multiple Requirements in external material template
2005-04-03 Alfredo Braunstein <abraunst@lyx.org>

View File

@ -126,8 +126,14 @@ public:
ost << "\tFormat " << vt.first << '\n'
<< "\t\tProduct " << ft.product << '\n'
<< "\t\tUpdateFormat " << ft.updateFormat << '\n'
<< "\t\tUpdateResult " << ft.updateResult << '\n'
<< "\t\tRequirement " << ft.requirement << '\n';
<< "\t\tUpdateResult " << ft.updateResult << '\n';
vector<string>::const_iterator qit = ft.requirements.begin();
vector<string>::const_iterator qend = ft.requirements.end();
for (; qit != qend; ++qit) {
lyxerr << "req:" << *qit << std::endl;
ost << "\t\tRequirement " << *qit << '\n';
}
typedef vector<Template::Option> Options;
Options::const_iterator oit = ft.options.begin();
@ -502,7 +508,7 @@ void Template::Format::readFormat(LyXLex & lex)
case FO_REQUIREMENT:
lex.next(true);
requirement = lex.getString();
requirements.push_back(lex.getString());
break;
case FO_PREAMBLE:

View File

@ -70,7 +70,7 @@ public:
/// The format of this file.
std::string updateFormat;
/// What features does this external inset require?
std::string requirement;
std::vector<std::string> requirements;
/// A collection of preamble snippets identified by name.
std::vector<std::string> preambleNames;
/// A list of options to the basic command.

View File

@ -737,13 +737,15 @@ void InsetExternal::validate(LaTeXFeatures & features) const
if (cit == et.formats.end())
return;
if (!cit->second.requirement.empty())
features.require(cit->second.requirement);
vector<string>::const_iterator it = cit->second.requirements.begin();
vector<string>::const_iterator end = cit->second.requirements.end();
for (; it != end; ++it)
features.require(*it);
external::TemplateManager & etm = external::TemplateManager::get();
vector<string>::const_iterator it = cit->second.preambleNames.begin();
vector<string>::const_iterator end = cit->second.preambleNames.end();
it = cit->second.preambleNames.begin();
end = cit->second.preambleNames.end();
for (; it != end; ++it) {
string const preamble = etm.getPreambleDefByName(*it);
if (!preamble.empty())