class documentation

Stores transforms (`Transform` classes) and applies them to document trees. Also keeps track of components by component type name.

Method __init__ Undocumented
Method add_pending Store a transform with an associated `pending` node.
Method add_transform 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_transforms Store multiple transforms, with default priorities.
Method apply_transforms Apply all of the stored transforms, in priority order.
Method get_priority_string Return a string, `priority` combined with `self.serialno`.
Method populate_from_components 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_reference_resolvers List of hook functions which assist in resolving references

Inherited from TransformSpec:

Method get_transforms Transforms required by this class. Override in subclasses.
Class Variable default_transforms Undocumented
def __init__(self, document): (source)

Undocumented

def add_pending(self, pending, priority=None): (source)

Store a transform with an associated `pending` node.

def add_transform(self, transform_class, priority=None, **kwargs): (source)

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.

def add_transforms(self, transform_list): (source)

Store multiple transforms, with default priorities.

def apply_transforms(self): (source)

Apply all of the stored transforms, in priority order.

def get_priority_string(self, priority): (source)

Return a string, `priority` combined with `self.serialno`. This ensures FIFO order on transforms with identical priority.

def populate_from_components(self, components): (source)

Store each component's default transforms, with default priorities. Also, store components by type name in a mapping for later lookup.

applied: list = (source)

Transforms already applied, in order.

components: dict = (source)

Mapping of component type name to component object. Set by `self.populate_from_components()`.

document = (source)

The `nodes.document` object this Transformer is attached to.

serialno: int = (source)

Internal serial number to keep track of the add order of transforms.

sorted: int = (source)

Boolean: is `self.tranforms` sorted?

transforms: list = (source)

List of transforms to apply. Each item is a 4-tuple: ``(priority string, transform class, pending node or None, kwargs)``.

unknown_reference_resolvers: list = (source)

List of hook functions which assist in resolving references