From 3efd64696ffe1422bec7a9d383ff5fabe627b7b8 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Thu, 24 May 2018 17:38:10 +0200 Subject: [PATCH] Consider required modules when checking for layout definitions in modules Fixes: #11156. (cherry picked from commit 8b4c76fb2465402dc48915b965de8a6f9a884795) --- src/tex2lyx/tex2lyx.cpp | 26 +++++++++++++++++++------- status.23x | 3 +++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/tex2lyx/tex2lyx.cpp b/src/tex2lyx/tex2lyx.cpp index 416f1268f3..e6761dbc56 100644 --- a/src/tex2lyx/tex2lyx.cpp +++ b/src/tex2lyx/tex2lyx.cpp @@ -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 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; + } } } } diff --git a/status.23x b/status.23x index adc4947050..6a043fe363 100644 --- a/status.23x +++ b/status.23x @@ -94,6 +94,9 @@ What's new * TEX2LYX +- Consider required modules when checking for layout definitions in modules + (bug 11156). + * ADVANCED FIND AND REPLACE -- 2.39.5