docutils.transforms.misc module

Miscellaneous transforms.

class CallBack(document, startnode=None)[source]

Bases: Transform

Inserts a callback into a document. The callback is called when the transform is applied, which is determined by its priority.

For use with nodes.pending elements. Requires a details['callback'] entry, a bound method or function which takes one parameter: the pending node. Other data can be stored in the details attribute or in the object hosting the callback method.

default_priority = 990

Numerical priority of this transform, 0 through 999 (override).

apply()[source]

Override to apply the transform to the document tree.

class ClassAttribute(document, startnode=None)[source]

Bases: Transform

Move the “class” attribute specified in the “pending” node into the immediately following non-comment element.

default_priority = 210

Numerical priority of this transform, 0 through 999 (override).

apply()[source]

Override to apply the transform to the document tree.

class Transitions(document, startnode=None)[source]

Bases: Transform

Move transitions at the end of sections up the tree. Complain on transitions after a title, at the beginning or end of the document, and after another transition.

For example, transform this:

<section>
    ...
    <transition>
<section>
    ...

into this:

<section>
    ...
<transition>
<section>
    ...
default_priority = 830

Numerical priority of this transform, 0 through 999 (override).

apply()[source]

Override to apply the transform to the document tree.

visit_transition(node)[source]