# HG changeset patch
# User cmlenz
# Date 1181035980 0
# Node ID a2dca8066a5ad968d2142c211caa02fe21ac821a
# Parent 2e1dbb344b89ef52b6ba0c1999b7958355febf14
Renamed the transformation classes so that their role is clarified; extended the example in the package docstring to show chaining.
diff --git a/genshi/filters/transform.py b/genshi/filters/transform.py
--- a/genshi/filters/transform.py
+++ b/genshi/filters/transform.py
@@ -25,10 +25,21 @@
For example, the following transformation removes the ``
`` element from
the ```` of the input document:
->>> html = HTML('Some Title'
-... 'Some body text.')
->>> print html | Transformer('head/title').remove()
-Some body text.
+>>> from genshi.builder import tag
+>>> html = HTML('''
+... Some Title
+...
+... Some body text.
+...
+... ''')
+>>> print html | Transformer('body/em').apply(unicode.upper, TEXT) \\
+... .unwrap().wrap(tag.u)
+
+ Some Title
+
+ Some BODY text.
+
+
The ``Transformer`` support a large number of useful transformations out of the
box, but custom transformations can be added easily.
@@ -36,11 +47,12 @@
import sys
-from genshi.path import Path
from genshi.builder import Element
-from genshi.core import Stream, Attrs, QName, TEXT, START, END
+from genshi.core import Stream, Attrs, QName, TEXT, START, END, _ensure
+from genshi.path import Path
-__all__ = ['Transformer', 'Injector', 'ENTER', 'EXIT', 'INSIDE', 'OUTSIDE']
+__all__ = ['Transformer', 'InjectorTransformation', 'ENTER', 'EXIT', 'INSIDE',
+ 'OUTSIDE']
class TransformMark(str):
@@ -123,7 +135,7 @@
class="emphasis">body text.