mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Fix bug #10938.
This commit is contained in:
parent
8281a81b10
commit
2a78c1c662
@ -172,30 +172,26 @@ void add_known_theorem(string const & theorem, string const & o1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Layout const * findLayoutWithoutModule(TextClass const & textclass,
|
Layout const * findLayoutWithoutModule(TextClass const & tc,
|
||||||
string const & name, bool command)
|
string const & name, bool command)
|
||||||
{
|
{
|
||||||
DocumentClass::const_iterator it = textclass.begin();
|
for (auto const & lay : tc) {
|
||||||
DocumentClass::const_iterator en = textclass.end();
|
if (lay.latexname() == name &&
|
||||||
for (; it != en; ++it) {
|
((command && lay.isCommand()) || (!command && lay.isEnvironment())))
|
||||||
if (it->latexname() == name &&
|
return &lay;
|
||||||
((command && it->isCommand()) || (!command && it->isEnvironment())))
|
|
||||||
return &*it;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetLayout const * findInsetLayoutWithoutModule(TextClass const & textclass,
|
InsetLayout const * findInsetLayoutWithoutModule(TextClass const & tc,
|
||||||
string const & name, bool command)
|
string const & name, bool command)
|
||||||
{
|
{
|
||||||
DocumentClass::InsetLayouts::const_iterator it = textclass.insetLayouts().begin();
|
for (auto const & ilay : tc.insetLayouts()) {
|
||||||
DocumentClass::InsetLayouts::const_iterator en = textclass.insetLayouts().end();
|
if (ilay.second.latexname() == name &&
|
||||||
for (; it != en; ++it) {
|
((command && ilay.second.latextype() == InsetLayout::COMMAND) ||
|
||||||
if (it->second.latexname() == name &&
|
(!command && ilay.second.latextype() == InsetLayout::ENVIRONMENT)))
|
||||||
((command && it->second.latextype() == InsetLayout::COMMAND) ||
|
return &(ilay.second);
|
||||||
(!command && it->second.latextype() == InsetLayout::ENVIRONMENT)))
|
|
||||||
return &(it->second);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -359,29 +355,29 @@ bool checkModule(string const & name, bool command)
|
|||||||
Layout const * layout = findLayoutWithoutModule(*c, name, command);
|
Layout const * layout = findLayoutWithoutModule(*c, name, command);
|
||||||
InsetLayout const * insetlayout = layout ? 0 :
|
InsetLayout const * insetlayout = layout ? 0 :
|
||||||
findInsetLayoutWithoutModule(*c, name, command);
|
findInsetLayoutWithoutModule(*c, name, command);
|
||||||
docstring preamble;
|
docstring dpre;
|
||||||
if (layout)
|
if (layout)
|
||||||
preamble = layout->preamble();
|
dpre = layout->preamble();
|
||||||
else if (insetlayout)
|
else if (insetlayout)
|
||||||
preamble = insetlayout->preamble();
|
dpre = insetlayout->preamble();
|
||||||
if (preamble.empty())
|
if (dpre.empty())
|
||||||
continue;
|
continue;
|
||||||
bool add = false;
|
bool add = false;
|
||||||
if (command) {
|
if (command) {
|
||||||
FullCommand const & cmd =
|
FullCommand const & cmd =
|
||||||
possible_textclass_commands['\\' + name];
|
possible_textclass_commands['\\' + name];
|
||||||
if (preamble.find(cmd.def) != docstring::npos)
|
if (dpre.find(cmd.def) != docstring::npos)
|
||||||
add = true;
|
add = true;
|
||||||
} else if (theorem) {
|
} else if (theorem) {
|
||||||
FullCommand const & thm =
|
FullCommand const & thm =
|
||||||
possible_textclass_theorems[name];
|
possible_textclass_theorems[name];
|
||||||
if (preamble.find(thm.def) != docstring::npos)
|
if (dpre.find(thm.def) != docstring::npos)
|
||||||
add = true;
|
add = true;
|
||||||
} else {
|
} else {
|
||||||
FullEnvironment const & env =
|
FullEnvironment const & env =
|
||||||
possible_textclass_environments[name];
|
possible_textclass_environments[name];
|
||||||
if (preamble.find(env.beg) != docstring::npos &&
|
if (dpre.find(env.beg) != docstring::npos &&
|
||||||
preamble.find(env.end) != docstring::npos)
|
dpre.find(env.end) != docstring::npos)
|
||||||
add = true;
|
add = true;
|
||||||
}
|
}
|
||||||
if (add) {
|
if (add) {
|
||||||
|
@ -103,10 +103,9 @@ extern void add_known_environment(std::string const & environment,
|
|||||||
docstring const & end);
|
docstring const & end);
|
||||||
extern void add_known_theorem(std::string const & theorem,
|
extern void add_known_theorem(std::string const & theorem,
|
||||||
std::string const & o1, bool o2, docstring const & definition);
|
std::string const & o1, bool o2, docstring const & definition);
|
||||||
extern Layout const * findLayoutWithoutModule(TextClass const & textclass,
|
extern Layout const * findLayoutWithoutModule(TextClass const & tc,
|
||||||
std::string const & name, bool command);
|
std::string const & name, bool command);
|
||||||
extern InsetLayout const * findInsetLayoutWithoutModule(
|
extern InsetLayout const * findInsetLayoutWithoutModule(TextClass const & tc, std::string const & name, bool command);
|
||||||
TextClass const & textclass, std::string const & name, bool command);
|
|
||||||
/*!
|
/*!
|
||||||
* Check whether a module provides command (if \p command is true) or
|
* Check whether a module provides command (if \p command is true) or
|
||||||
* environment (if \p command is false) \p name, and add the module to the
|
* environment (if \p command is false) \p name, and add the module to the
|
||||||
|
Loading…
Reference in New Issue
Block a user