class documentation

class Transformer(TransformSpec):

View In Hierarchy

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 No summary
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):

Undocumented

def add_pending(self, pending, priority=None):
Store a transform with an associated pending node.
def add_transform(self, transform_class, priority=None, **kwargs):
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):
Store multiple transforms, with default priorities.
def apply_transforms(self):
Apply all of the stored transforms, in priority order.
def get_priority_string(self, priority):

Return a string, priority combined with self.serialno.

This ensures FIFO order on transforms with identical priority.

def populate_from_components(self, components):
Store each component's default transforms, with default priorities. Also, store components by type name in a mapping for later lookup.
applied: list =
Transforms already applied, in order.
components: dict =
Mapping of component type name to component object. Set by self.populate_from_components().
document =
The nodes.document object this Transformer is attached to.
serialno: int =
Internal serial number to keep track of the add order of transforms.
sorted: int =
Boolean: is self.tranforms sorted?
transforms: list =
List of transforms to apply. Each item is a 4-tuple: (priority string, transform class, pending node or None, kwargs).
unknown_reference_resolvers: list =
List of hook functions which assist in resolving references