[Checkins] SVN: z3c.pt/trunk/src/z3c/pt/genshi.txt Another recursive method test

Wichert Akkerman wichert at wiggy.net
Thu Aug 21 10:32:57 EDT 2008


Log message for revision 90068:
  Another recursive method test

Changed:
  U   z3c.pt/trunk/src/z3c/pt/genshi.txt

-=-
Modified: z3c.pt/trunk/src/z3c/pt/genshi.txt
===================================================================
--- z3c.pt/trunk/src/z3c/pt/genshi.txt	2008-08-21 14:29:26 UTC (rev 90067)
+++ z3c.pt/trunk/src/z3c/pt/genshi.txt	2008-08-21 14:32:56 UTC (rev 90068)
@@ -394,7 +394,7 @@
   </script>
   </div>
 
-:: Sometimes a function does not return a result
+:: Very basic recursing
 
   >>> print render_genshi("""\
   ... <div xmlns="http://www.w3.org/1999/xhtml"
@@ -411,6 +411,29 @@
   </ul>
   </div>
 
+:: Slightly more complex recursive function calls
+ 
+  >>> print render_genshi("""\
+  ... <div xmlns="http://www.w3.org/1999/xhtml"
+  ...       xmlns:py="http://genshi.edgewall.org">
+  ...   <ul py:def="rendermenu(menu)">
+  ...     <li py:for="entry in menu"
+  ...         py:attrs="{'class' : entry['current'] and 'current' or None}">
+  ...       <a py:attrs="dict(href=entry['url'])"
+  ...          py:content="entry['title']">Merken</a>
+  ...       
+  ...       ${rendermenu(entry.get('children', []))}
+  ...     </li>
+  ...   </ul>
+  ...   ${rendermenu(menu))}
+  ... </div>""", menu=[dict(title=u"Menu entry", url="/test", current=True)])
+  <div xmlns="http://www.w3.org/1999/xhtml"
+        xmlns:py="http://genshi.edgewall.org">
+  <ul>
+    <li>
+    </li>
+  </ul>
+  </div>
   
 .. _py:with specs: http://genshi.edgewall.org/wiki/Documentation/0.4.x/xml-templates.html#py-with
 



More information about the Checkins mailing list