ó V!¶\c@sxdZdZddlmZddlmZmZdefd„ƒYZdefd„ƒYZd efd „ƒYZ d S( s Miscellaneous transforms. treStructuredTextiÿÿÿÿ(tnodes(t TransformtTransformErrortCallBackcBseZdZdZd„ZRS(s 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|ƒ|jj|ƒdS(Ntcallback(t startnodetdetailstparenttremove(tselftpending((s</tmp/pip-install-usGedi/docutils/docutils/transforms/misc.pytapplys (t__name__t __module__t__doc__tdefault_priorityR (((s</tmp/pip-install-usGedi/docutils/docutils/transforms/misc.pyRs tClassAttributecBseZdZdZd„ZRS(s| Move the "class" attribute specified in the "pending" node into the immediately following non-comment element. iÒcCs |j}|j}|}x¢|r¼x•t|j|ƒdt|ƒƒD]b}||}t|tjƒsDt|tjƒr~qDn|dc|j d7<|jj |ƒdSW|}|j}qW|j j j d|j dtj|j|jƒd|jƒ}|j|ƒdS(Nitclassestclasss,No suitable element following "%s" directivet directivetline(RRtrangetindextlent isinstanceRt Invisibletsystem_messageRR tdocumenttreporterterrort literal_blockt rawsourceRt replace_self(R R RtchildRtelementR((s</tmp/pip-install-usGedi/docutils/docutils/transforms/misc.pyR ,s(   )     (R RRRR (((s</tmp/pip-install-usGedi/docutils/docutils/transforms/misc.pyR#st TransitionscBs&eZdZdZd„Zd„ZRS(s¡ 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::
...
... into this::
...
... i>cCs1x*|jjtjƒD]}|j|ƒqWdS(N(RttraverseRt transitiontvisit_transition(R tnode((s</tmp/pip-install-usGedi/docutils/docutils/transforms/misc.pyR `scCs-|jj|ƒ}d}|dksnt|jdtjƒrÈ|dksnt|jdtjƒrÈ|dkrÈt|jtjƒsžt|jtjƒsžt ‚|jj j dd|j d|j ƒ}nGt|j|dtjƒr|jj j dd|j d|j ƒ}n|r5|jj||ƒ|d7}n|t|jƒksPt ‚|t|jƒdkrmdS|}xŒ|t|jƒdkr|j}|jdkrì|jj j dd|j ƒ}|jj|jj|ƒd|ƒdS|jj|ƒ}qvW|jj|ƒ|jj|d|ƒdS( Niiis4Document or section may not begin with a transition.tsourceRsZAt least one body element must separate transitions; adjacent transitions are not allowed.s'Document may not end with a transition.(RRtNoneRRttitletsubtitleRtsectiontAssertionErrorRRR)RR&tinsertRR (R R(RRtsibling((s</tmp/pip-install-usGedi/docutils/docutils/transforms/misc.pyR'dsD         #(R RRRR R'(((s</tmp/pip-install-usGedi/docutils/docutils/transforms/misc.pyR$Fs N( Rt __docformat__tdocutilsRtdocutils.transformsRRRRR$(((s</tmp/pip-install-usGedi/docutils/docutils/transforms/misc.pyts #