B “äî\ã@sXdZdZddlmZddlmZmZGdd„deƒZGdd„deƒZGd d „d eƒZ d S) z Miscellaneous transforms. ZreStructuredTexté)Únodes)Ú TransformÚTransformErrorc@seZdZdZdZdd„ZdS)ÚCallBacka� 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. iÞcCs$|j}|jd|ƒ|j |¡dS)NÚcallback)Ú startnodeÚdetailsÚparentÚremove)ÚselfÚpending©r ú ...
... into this::
...
... i>cCs&x |j tj¡D]}| |¡qWdS)N)rZtraverserÚ transitionÚvisit_transition)r Únoder r rr`szTransitions.applycCs†|j |¡}d}|dksLt|jdtjƒr†|dksLt|jdtjƒr†|dkr†t|jtjƒslt|jtjƒslt‚|jj j d|j |j d�}n.t|j|dtj ƒr´|jj j d|j |j d�}|rÎ|j ||¡|d7}|t|jƒksàt‚|t|jƒdkrödS|}xh|t|jƒdk�rb|j}|jdk�rT|jj j d|j d�}|j |j |¡d|¡dS|j |¡}qüW|j |¡|j |d|¡dS) Nrréz4Document or section may not begin with a transition.)ÚsourcerzZAt least one body element must separate transitions; adjacent transitions are not allowed.z'Document may not end with a transition.)r)r rrrÚtitleZsubtitlerÚsectionÚAssertionErrorr r!r)rr%Úinsertrr )r r'rr!Zsiblingr r rr&dsD    zTransitions.visit_transitionN)rrrrrrr&r r r rr$Fsr$N) rZ __docformat__ZdocutilsrZdocutils.transformsrrrrr$r r r rÚs  #