[Checkins] SVN: z3c.pt/trunk/ Omit element text when using macro.

Malthe Borch mborch at gmail.com
Sat Sep 13 17:47:27 EDT 2008


Log message for revision 91129:
  Omit element text when using macro.

Changed:
  U   z3c.pt/trunk/CHANGES.txt
  U   z3c.pt/trunk/src/z3c/pt/translation.py
  U   z3c.pt/trunk/src/z3c/pt/zpt.txt

-=-
Modified: z3c.pt/trunk/CHANGES.txt
===================================================================
--- z3c.pt/trunk/CHANGES.txt	2008-09-13 20:05:41 UTC (rev 91128)
+++ z3c.pt/trunk/CHANGES.txt	2008-09-13 21:47:26 UTC (rev 91129)
@@ -185,6 +185,8 @@
 
   Bugfixes
 
+- Omit element text when rendering macro. [malthe]
+  
 - ``Macros`` class should not return callable functions, but rather a
   ``Macro`` object, which has a ``render``-method. This makes it
   possible to use a path-expression to get to a macro without calling

Modified: z3c.pt/trunk/src/z3c/pt/translation.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/translation.py	2008-09-13 20:05:41 UTC (rev 91128)
+++ z3c.pt/trunk/src/z3c/pt/translation.py	2008-09-13 21:47:26 UTC (rev 91129)
@@ -200,7 +200,7 @@
                 _.append(tag)
 
         # tag text (if we're not replacing tag body)
-        if text and not dynamic:
+        if text and not dynamic and not self.use_macro:
             if isinstance(text, unicode) and self.stream.encoding:
                 text = text.encode(self.stream.encoding)
             _.append(clauses.Out(text))

Modified: z3c.pt/trunk/src/z3c/pt/zpt.txt
===================================================================
--- z3c.pt/trunk/src/z3c/pt/zpt.txt	2008-09-13 20:05:41 UTC (rev 91128)
+++ z3c.pt/trunk/src/z3c/pt/zpt.txt	2008-09-13 21:47:26 UTC (rev 91129)
@@ -318,6 +318,7 @@
   ...     Hello, <b class="name" metal:define-slot="name">stranger!</b>
   ...   </div>
   ...   <div metal:use-macro="template.macros['greeting']">
+  ...     This will be omitted
   ...     <span metal:fill-slot="name">earth!</span>
   ...   </div>
   ...   <div metal:use-macro="template.macros['greeting']">



More information about the Checkins mailing list