|
|
|
@ -1961,6 +1961,9 @@ class DirectoryProcessor:
|
|
|
|
|
else:
|
|
|
|
|
self._add_package_to_group(group_name, package_name)
|
|
|
|
|
|
|
|
|
|
# Создаем переменную для указания текущих шаблонов, если ее еще нет.
|
|
|
|
|
self._make_current_template_var()
|
|
|
|
|
|
|
|
|
|
# Инициализируем шаблонизатор.
|
|
|
|
|
self.template_engine = TemplateEngine(
|
|
|
|
|
datavars_module=self.datavars_module,
|
|
|
|
@ -2089,6 +2092,29 @@ class DirectoryProcessor:
|
|
|
|
|
continue
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def _make_current_template_var(self) -> None:
|
|
|
|
|
var_path = ['main', 'cl']
|
|
|
|
|
namespace = self.datavars_module
|
|
|
|
|
print("namespace:", namespace)
|
|
|
|
|
|
|
|
|
|
for field in var_path:
|
|
|
|
|
if field not in namespace:
|
|
|
|
|
if isinstance(self.datavars_module, (Datavars, NamespaceNode)):
|
|
|
|
|
namespace = NamespaceNode(field, parent=namespace)
|
|
|
|
|
else:
|
|
|
|
|
namespace[field] = Variables()
|
|
|
|
|
namespace = namespace[field]
|
|
|
|
|
else:
|
|
|
|
|
namespace = namespace[field]
|
|
|
|
|
|
|
|
|
|
if 'current_template' not in namespace:
|
|
|
|
|
if isinstance(self.datavars_module, (Datavars, NamespaceNode)):
|
|
|
|
|
variable = VariableNode('current_template', namespace,
|
|
|
|
|
variable_type=StringType,
|
|
|
|
|
source="")
|
|
|
|
|
else:
|
|
|
|
|
namespace['current_template'] = ""
|
|
|
|
|
|
|
|
|
|
def process_template_directories(self) -> None:
|
|
|
|
|
'''Метод для обхода шаблонов, содержащихся в каталогах из
|
|
|
|
|
main.cl_template.path.'''
|
|
|
|
@ -2429,7 +2455,8 @@ class DirectoryProcessor:
|
|
|
|
|
# Удаляем все параметры, которые не наследуются и используем
|
|
|
|
|
# полученный контейнер для сбора параметров файлов шаблонов.
|
|
|
|
|
template_parameters.remove_not_inheritable()
|
|
|
|
|
template_path = os.path.join(current_directory_path, template_name)
|
|
|
|
|
template_path = os.path.join(current_directory_path,
|
|
|
|
|
template_name)
|
|
|
|
|
|
|
|
|
|
# Применяем к файлу шаблона шаблонизатор.
|
|
|
|
|
template_text = self._parse_template(template_parameters,
|
|
|
|
@ -2625,6 +2652,10 @@ class DirectoryProcessor:
|
|
|
|
|
else:
|
|
|
|
|
template_path = join_paths(template_directory, template_name)
|
|
|
|
|
|
|
|
|
|
if isinstance(self.datavars_module, (Datavars, NamespaceNode)):
|
|
|
|
|
self.datavars_module.main.cl['current_template'].set(template_path)
|
|
|
|
|
else:
|
|
|
|
|
self.datavars_module.main.cl['current_template'] = template_path
|
|
|
|
|
try:
|
|
|
|
|
self.template_engine.process_template(template_name,
|
|
|
|
|
template_type,
|
|
|
|
|