#122 closed enhancement (fixed)
JQueryesque transformations of Genshi streams
Reported by: | Alec Thomas <alec@…> | Owned by: | cmlenz |
---|---|---|---|
Priority: | minor | Milestone: | 0.5 |
Component: | General | Version: | devel |
Keywords: | Cc: |
Description
Implementation of a JQuery-like stream transformation filter. Best shown by example. The following copies the <title/> contents into the body, simultaneously enclosing it in <h1/>:
>>> from genshi import XML >>> from genshi.builder import tag >>> from genshi.filters.transform import Transform >>> stream = XML('<html><head><title>Some Title</title></head><body>' ... 'Some <em>body</em> text.</body></html>') >>> buffer = [] >>> transform = Transform('.//title/text()').copy(buffer).select('.//body'). \ ... prepend(tag.h1(buffer)) >>> print stream | transform <html><head><title>Some Title</title></head><body><h1>Some Title</h1>Some <em>body</em> text.</body></html>
Attachments (1)
Change History (2)
Changed 18 years ago by Alec Thomas <alec@…>
comment:1 Changed 18 years ago by cmlenz
- Resolution set to fixed
- Status changed from new to closed
Checked in in [605]. Awesome work, thanks a lot!
Note: See
TracTickets for help on using
tickets.
Genshi transform filter patch