Consider required modules when checking for layout definitions in modules

Fixes: #11156.
(cherry picked from commit 8b4c76fb24)
This commit is contained in:
Juergen Spitzmueller 2018-05-24 17:38:10 +02:00
parent 995aed2e6e
commit 3efd64696f
2 changed files with 22 additions and 7 deletions

View File

@ -387,13 +387,25 @@ bool checkModule(string const & name, bool command)
add = true;
}
if (add) {
FileName layout_file = libFileSearch("layouts", module, "module");
if (textclass.read(layout_file, TextClass::MODULE)) {
used_modules.push_back(module);
// speed up further searches:
// the module does not need to be checked anymore.
modules.erase(it);
return true;
vector<string> v;
LayoutModuleList mods;
// addModule is necessary in order to catch required modules
// as well (see #11156)
if (!addModule(module, baseClass, mods, v))
return false;
for (auto const & mod : mods) {
if (!used_modules.moduleCanBeAdded(mod, &baseClass))
return false;
FileName layout_file = libFileSearch("layouts", mod, "module");
if (textclass.read(layout_file, TextClass::MODULE)) {
used_modules.push_back(mod);
// speed up further searches:
// the module does not need to be checked anymore.
ModuleMap::iterator const it = modules.find(mod);
if (it != modules.end())
modules.erase(it);
return true;
}
}
}
}

View File

@ -94,6 +94,9 @@ What's new
* TEX2LYX
- Consider required modules when checking for layout definitions in modules
(bug 11156).
* ADVANCED FIND AND REPLACE