class Transformer(TransformSpec): (source)
Stores transforms (`Transform` classes) and applies them to document trees. Also keeps track of components by component type name.
Method | __init__ |
Undocumented |
Method | add |
Store a transform with an associated `pending` node. |
Method | add |
Store a single transform. Use `priority` to override the default. `kwargs` is a dictionary whose contents are passed as keyword arguments to the `apply` method of the transform. This can be used to pass application-specific data to the transform instance. |
Method | add |
Store multiple transforms, with default priorities. |
Method | apply |
Apply all of the stored transforms, in priority order. |
Method | get |
Return a string, `priority` combined with `self.serialno`. |
Method | populate |
Store each component's default transforms, with default priorities. Also, store components by type name in a mapping for later lookup. |
Instance Variable | applied |
Transforms already applied, in order. |
Instance Variable | components |
Mapping of component type name to component object. Set by `self.populate_from_components()`. |
Instance Variable | document |
The `nodes.document` object this Transformer is attached to. |
Instance Variable | serialno |
Internal serial number to keep track of the add order of transforms. |
Instance Variable | sorted |
Boolean: is `self.tranforms` sorted? |
Instance Variable | transforms |
List of transforms to apply. Each item is a 4-tuple: ``(priority string, transform class, pending node or None, kwargs)``. |
Instance Variable | unknown |
List of hook functions which assist in resolving references |
Inherited from TransformSpec
:
Method | get |
Transforms required by this class. Override in subclasses. |
Class Variable | default |
Undocumented |
Store a single transform. Use `priority` to override the default. `kwargs` is a dictionary whose contents are passed as keyword arguments to the `apply` method of the transform. This can be used to pass application-specific data to the transform instance.
Return a string, `priority` combined with `self.serialno`. This ensures FIFO order on transforms with identical priority.
Store each component's default transforms, with default priorities. Also, store components by type name in a mapping for later lookup.
List of transforms to apply. Each item is a 4-tuple: ``(priority string, transform class, pending node or None, kwargs)``.