Mercurial > genshi > genshi-test
changeset 6:5da45906dda7
Simplified implementation of `py:content` directive.
author | cmlenz |
---|---|
date | Sun, 04 Jun 2006 10:46:14 +0000 |
parents | 1add946decb8 |
children | e0f230569eb1 |
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('&', '&') 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