Convert documentation of _prepare_template_tags to docstring.
This commit is contained in:
parent
8f1bde4035
commit
0a1d0cc43b
1 changed files with 38 additions and 37 deletions
75
secretary.py
75
secretary.py
|
|
@ -167,43 +167,44 @@ class Renderer(object):
|
||||||
return zip_file
|
return zip_file
|
||||||
|
|
||||||
def _prepare_template_tags(self, xml_document):
|
def _prepare_template_tags(self, xml_document):
|
||||||
# Here we search for every field node present in xml_document.
|
""" Here we search for every field node present in xml_document.
|
||||||
# For each field we found we do:
|
For each field we found we do:
|
||||||
# * if field is a print field ({{ field }}), we replace it with a
|
* if field is a print field ({{ field }}), we replace it with a
|
||||||
# <text:span> node.
|
<text:span> node.
|
||||||
#
|
|
||||||
# * if field is a control flow ({% %}), then we find immediate node of
|
* if field is a control flow ({% %}), then we find immediate node of
|
||||||
# type indicated in field's `text:description` attribute and replace
|
type indicated in field's `text:description` attribute and replace
|
||||||
# the whole node and its childrens with field's content.
|
the whole node and its childrens with field's content.
|
||||||
#
|
|
||||||
# If `text:description` attribute starts with `before::` or `after::`,
|
If `text:description` attribute starts with `before::` or `after::`,
|
||||||
# then we move field content before or after the node in description.
|
then we move field content before or after the node in description.
|
||||||
#
|
|
||||||
# If no `text:description` is available, find the immediate common
|
If no `text:description` is available, find the immediate common
|
||||||
# parent of this and any other field and replace its child and
|
parent of this and any other field and replace its child and
|
||||||
# original parent of field with the field content.
|
original parent of field with the field content.
|
||||||
#
|
|
||||||
# e.g.: original
|
e.g.: original
|
||||||
# <table>
|
<table>
|
||||||
# <table:row>
|
<table:row>
|
||||||
# <field>{% for bar in bars %}</field>
|
<field>{% for bar in bars %}</field>
|
||||||
# </table:row>
|
</table:row>
|
||||||
# <paragraph>
|
<paragraph>
|
||||||
# <field>{{ bar }}</field>
|
<field>{{ bar }}</field>
|
||||||
# </paragraph>
|
</paragraph>
|
||||||
# <table:row>
|
<table:row>
|
||||||
# <field>{% endfor %}</field>
|
<field>{% endfor %}</field>
|
||||||
# </table:row>
|
</table:row>
|
||||||
# </table>
|
</table>
|
||||||
#
|
|
||||||
# After processing:
|
After processing:
|
||||||
# <table>
|
<table>
|
||||||
# {% for bar in bars %}
|
{% for bar in bars %}
|
||||||
# <paragraph>
|
<paragraph>
|
||||||
# <text:span>{{ bar }}</text:span>
|
<text:span>{{ bar }}</text:span>
|
||||||
# </paragraph>
|
</paragraph>
|
||||||
# {% endfor %}
|
{% endfor %}
|
||||||
# </table>
|
</table>
|
||||||
|
"""
|
||||||
|
|
||||||
self.log.debug('Preparing template tags')
|
self.log.debug('Preparing template tags')
|
||||||
fields = xml_document.getElementsByTagName('text:text-input')
|
fields = xml_document.getElementsByTagName('text:text-input')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue