docutils.transforms.universal module
Transforms needed by most or all documents:
Decorations: Generate a document’s header & footer.
ExposeInternals: Expose internal attributes.
Messages: Placement of system messages generated after parsing.
FilterMessages: Remove system messages below verbosity threshold.
TestMessages: Like Messages, used on test runs.
StripComments: Remove comment elements from the document tree.
StripClassesAndElements: Remove elements with classes in self.document.settings.strip_elements_with_classes and class values in self.document.settings.strip_classes.
SmartQuotes: Replace ASCII quotation marks with typographic form.
- class Decorations(document, startnode=None)[source]
Bases:
TransformPopulate a document’s decoration element (header, footer).
- default_priority = 820
Numerical priority of this transform, 0 through 999 (override).
- class ExposeInternals(document, startnode=None)[source]
Bases:
TransformExpose internal attributes if
expose_internalssetting is set.- default_priority = 840
Numerical priority of this transform, 0 through 999 (override).
- class Messages(document, startnode=None)[source]
Bases:
TransformPlace any system messages generated after parsing into a dedicated section of the document.
- default_priority = 860
Numerical priority of this transform, 0 through 999 (override).
- class FilterMessages(document, startnode=None)[source]
Bases:
TransformRemove system messages below verbosity threshold.
Convert <problematic> nodes referencing removed messages to <Text>. Remove “System Messages” section if empty.
- default_priority = 870
Numerical priority of this transform, 0 through 999 (override).
- class TestMessages(document, startnode=None)[source]
Bases:
TransformAppend all post-parse system messages to the end of the document.
Used for testing purposes.
- default_priority = 880
Numerical priority of this transform, 0 through 999 (override).
- class StripComments(document, startnode=None)[source]
Bases:
TransformRemove comment elements from the document tree (only if the
strip_commentssetting is enabled).- default_priority = 740
Numerical priority of this transform, 0 through 999 (override).
- class StripClassesAndElements(document, startnode=None)[source]
Bases:
TransformRemove from the document tree all elements with classes in self.document.settings.strip_elements_with_classes and all “classes” attribute values in self.document.settings.strip_classes.
- default_priority = 420
Numerical priority of this transform, 0 through 999 (override).
- class SmartQuotes(document, startnode)[source]
Bases:
TransformReplace ASCII quotation marks with typographic form.
Also replace multiple dashes with em-dash/en-dash characters.
- default_priority = 855
Numerical priority of this transform, 0 through 999 (override).
- nodes_to_skip = (<class 'docutils.nodes.FixedTextElement'>, <class 'docutils.nodes.Special'>)
Do not apply “smartquotes” to instances of these block-level nodes.
- literal_nodes = (<class 'docutils.nodes.FixedTextElement'>, <class 'docutils.nodes.Special'>, <class 'docutils.nodes.image'>, <class 'docutils.nodes.literal'>, <class 'docutils.nodes.math'>, <class 'docutils.nodes.raw'>, <class 'docutils.nodes.problematic'>)
Do not apply smartquotes to instances of these inline nodes.
- smartquotes_action = 'qDe'
Setting to select smartquote transformations.
The default ‘qDe’ educates normal quote characters: (”, ‘), em- and en-dashes (—, –) and ellipses (…).