changeset 6:71e8e645fe81 trunk

Simplified implementation of `py:content` directive.
author cmlenz
date Sun, 04 Jun 2006 10:46:14 +0000
parents dbb08edbc615
children 798ebd2425dc
files examples/turbogears/markuptest/templates/master.html markup/core.py markup/template.py
diffstat 3 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/examples/turbogears/markuptest/templates/master.html
+++ b/examples/turbogears/markuptest/templates/master.html
@@ -32,7 +32,7 @@
 
     <div py:if="tg_flash" class="flash" py:content="tg_flash"></div>
 
-    ${select('*')}
+    ${select('*/*')}
 
     <p align="center"><img src="/static/images/tg_under_the_hood.png" alt="TurboGears under the hood"/></p>
 </body>
--- a/markup/core.py
+++ b/markup/core.py
@@ -246,7 +246,9 @@
                             .replace('&amp;', '&')
 
     def plaintext(self, keeplinebreaks=True):
-        """Returns the text as a `unicode`with all entities and tags removed."""
+        """Returns the text as a `unicode` string with all entities and tags
+        removed.
+        """
         text = unicode(self.striptags().stripentities())
         if not keeplinebreaks:
             text = text.replace('\n', ' ')
--- a/markup/template.py
+++ b/markup/template.py
@@ -242,11 +242,10 @@
         if kind is Stream.START:
             yield kind, data, pos # emit start tag
         yield Stream.EXPR, self.expr, pos
-        previous = None
-        try:
-            while True:
-                previous = stream.next()
-        except StopIteration:
+        previous = stream.next()
+        for event in stream:
+            previous = event
+        else:
             if previous is not None:
                 yield previous
 
Copyright (C) 2012-2017 Edgewall Software