diff --git a/pym/calculate/lib/cl_template.py b/pym/calculate/lib/cl_template.py index 58eef7f..eb35712 100644 --- a/pym/calculate/lib/cl_template.py +++ b/pym/calculate/lib/cl_template.py @@ -1805,6 +1805,10 @@ class TemplateFormat(_error): def set_parent(self, parent): self.parent = parent + @property + def template_name(self): + return self.parent.nameFileTemplate + def getIni(self, key, nameFile=""): return self.parent.functObj.getIni(key, nameFile) diff --git a/pym/calculate/lib/format/world.py b/pym/calculate/lib/format/world.py index 5083699..7f39782 100644 --- a/pym/calculate/lib/format/world.py +++ b/pym/calculate/lib/format/world.py @@ -18,6 +18,7 @@ import sys from calculate.lib.cl_template import TemplateFormat from calculate.lib.utils.text import _u from calculate.lib.cl_lang import setLocalTranslate +from os import path _ = lambda x: x setLocalTranslate('cl_lib3', sys.modules[__name__]) @@ -55,9 +56,16 @@ class world(TemplateFormat): def textToXML(self): """Создание документа из текста self.text """ + category = path.basename(path.dirname(self.template_name)) + + def autocategory(name): + if name and "/" not in name: + prefix, op, name = name.rpartition("!") + return "%s%s%s/%s" % (prefix, op, category, name) + return name try: doc = filter(None, - [x.strip() for x in self.text.split("\n") + [autocategory(x.strip()) for x in self.text.split("\n") if not x.startswith("#")]) except ValueError: doc = False