Mercurial > genshi > genshi-test
comparison genshi/filters/transform.py @ 789:5c93aefcd93f stable-0.5.x
Ported [913], [927], and [928] to the 0.5.x branch.
author | cmlenz |
---|---|
date | Tue, 19 Aug 2008 11:51:06 +0000 |
parents | dc18772c5a44 |
children | 7cf2407671c2 |
comparison
equal
deleted
inserted
replaced
780:f8d858804ec6 | 789:5c93aefcd93f |
---|---|
492 | 492 |
493 >>> from genshi.builder import tag | 493 >>> from genshi.builder import tag |
494 >>> buffer = StreamBuffer() | 494 >>> buffer = StreamBuffer() |
495 >>> html = HTML('<html><head><title>Some Title</title></head>' | 495 >>> html = HTML('<html><head><title>Some Title</title></head>' |
496 ... '<body>Some <em>body</em> text.</body></html>') | 496 ... '<body>Some <em>body</em> text.</body></html>') |
497 >>> print html | Transformer('title/text()').copy(buffer) \\ | 497 >>> print html | Transformer('head/title/text()').copy(buffer) \\ |
498 ... .end().select('body').prepend(tag.h1(buffer)) | 498 ... .end().select('body').prepend(tag.h1(buffer)) |
499 <html><head><title>Some Title</title></head><body><h1>Some | 499 <html><head><title>Some Title</title></head><body><h1>Some |
500 Title</h1>Some <em>body</em> text.</body></html> | 500 Title</h1>Some <em>body</em> text.</body></html> |
501 | 501 |
502 This example illustrates that only a single contiguous selection will | 502 This example illustrates that only a single contiguous selection will |