Edgewall Software

Ticket #122 (closed enhancement: fixed)

Opened 8 years ago

Last modified 2 years ago

JQueryesque transformations of Genshi streams

Reported by: Alec Thomas <alec@…> Owned by: cmlenz
Priority: minor Milestone: 0.5
Component: General Version: devel
Keywords: Cc:


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>


genshi-transform.diff Download (29.3 KB) - added by Alec Thomas <alec@…> 8 years ago.
Genshi transform filter patch

Change History

Changed 8 years ago by Alec Thomas <alec@…>

Genshi transform filter patch

Changed 8 years ago by cmlenz

  • status changed from new to closed
  • resolution set to fixed

Checked in in [605]. Awesome work, thanks a lot!

Add/Change #122 (JQueryesque transformations of Genshi streams)


E-mail address and user name can be saved in the Preferences.

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'
Note: See TracTickets for help on using tickets.