Refactoring of pack an unpack template and result.'
This commit is contained in:
parent
06769a3a39
commit
3c186ae389
1 changed files with 4 additions and 4 deletions
|
|
@ -194,7 +194,7 @@ class Render():
|
||||||
self._template_vars = kwargs
|
self._template_vars = kwargs
|
||||||
|
|
||||||
# Render content.xml
|
# Render content.xml
|
||||||
self.prepare_template_tags(self.content_body)
|
self.prepare_template_tags(self.content)
|
||||||
template = self._environment.from_string(self.content.toxml())
|
template = self._environment.from_string(self.content.toxml())
|
||||||
result = template.render(**kwargs)
|
result = template.render(**kwargs)
|
||||||
result = result.replace('\n', '<text:line-break/>')
|
result = result.replace('\n', '<text:line-break/>')
|
||||||
|
|
@ -229,8 +229,8 @@ class Render():
|
||||||
|
|
||||||
|
|
||||||
def create_text_span_node(self, xml_document, content):
|
def create_text_span_node(self, xml_document, content):
|
||||||
span = self.content.createElement('text:span')
|
span = xml_document.createElement('text:span')
|
||||||
text_node = self.create_text_node(self.content, content)
|
text_node = self.create_text_node(xml_document, content)
|
||||||
span.appendChild(text_node)
|
span.appendChild(text_node)
|
||||||
|
|
||||||
return span
|
return span
|
||||||
|
|
@ -239,7 +239,7 @@ class Render():
|
||||||
"""
|
"""
|
||||||
Creates a text node
|
Creates a text node
|
||||||
"""
|
"""
|
||||||
return self.content.createTextNode(text)
|
return xml_document.createTextNode(text)
|
||||||
|
|
||||||
|
|
||||||
def prepare_template_tags(self, xml_document):
|
def prepare_template_tags(self, xml_document):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue