|
|
|
@ -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
|
|
|
|
|