From 0a1d0cc43b0ae6cc7ead093390de129173559b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20Ram=C3=ADrez?= Date: Sat, 6 Sep 2014 19:02:50 -0600 Subject: [PATCH] Convert documentation of _prepare_template_tags to docstring. --- secretary.py | 75 ++++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/secretary.py b/secretary.py index a481131..a40a053 100644 --- a/secretary.py +++ b/secretary.py @@ -167,43 +167,44 @@ class Renderer(object): return zip_file def _prepare_template_tags(self, xml_document): - # Here we search for every field node present in xml_document. - # For each field we found we do: - # * if field is a print field ({{ field }}), we replace it with a - # node. - # - # * if field is a control flow ({% %}), then we find immediate node of - # type indicated in field's `text:description` attribute and replace - # the whole node and its childrens with field's content. - # - # If `text:description` attribute starts with `before::` or `after::`, - # then we move field content before or after the node in description. - # - # If no `text:description` is available, find the immediate common - # parent of this and any other field and replace its child and - # original parent of field with the field content. - # - # e.g.: original - # - # - # {% for bar in bars %} - # - # - # {{ bar }} - # - # - # {% endfor %} - # - #
- # - # After processing: - # - # {% for bar in bars %} - # - # {{ bar }} - # - # {% endfor %} - #
+ """ Here we search for every field node present in xml_document. + For each field we found we do: + * if field is a print field ({{ field }}), we replace it with a + node. + + * if field is a control flow ({% %}), then we find immediate node of + type indicated in field's `text:description` attribute and replace + the whole node and its childrens with field's content. + + If `text:description` attribute starts with `before::` or `after::`, + then we move field content before or after the node in description. + + If no `text:description` is available, find the immediate common + parent of this and any other field and replace its child and + original parent of field with the field content. + + e.g.: original + + + {% for bar in bars %} + + + {{ bar }} + + + {% endfor %} + +
+ + After processing: + + {% for bar in bars %} + + {{ bar }} + + {% endfor %} +
+ """ self.log.debug('Preparing template tags') fields = xml_document.getElementsByTagName('text:text-input')