mò uġOc@srdZdZdklZdklZlZdefd„ƒYZdefd„ƒYZdefd „ƒYZ d S( s Miscellaneous transforms. treStructuredText(snodes(s TransformsTransformErrortCallBackcBstZdZdZd„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.|i}|id|ƒ|ii|ƒdS(Ntcallback(tselft startnodetpendingtdetailstparenttremove(RR((tr/home/project-web/docutils/web-update/infrastructure/update-dir/aux/snapshots/docutils/docutils/transforms/misc.pytapplys (t__name__t __module__t__doc__tdefault_priorityR (((R Rs tClassAttributecBstZdZdZd„ZRS(s| Move the "class" attribute specified in the "pending" node into the immediately following non-comment element. iÒcCs|i}|i}|}xŞ|o˘x›t|i|ƒdt|ƒƒD]h}||}t |t i ƒpt |t i ƒoqEn|dc|i d7<|ii|ƒdSqEW|}|i}qW|iiid|i dt i|i|iƒd|iƒ}|i|ƒdS(Nitclassestclasss,No suitable element following "%s" directivet directivetline(RRRRtchildtrangetindextlentelementt isinstancetnodest Invisibletsystem_messageRRtdocumenttreporterterrort literal_blockt rawsourceRt replace_self(RRRRRRR((R R ,s&  # &(R R R RR (((R R#s t TransitionscBs&tZdZdZd„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*|iitiƒD]}|i|ƒqWdS(N(RRttraverseRt transitiontnodetvisit_transition(RR&((R R `scCsH|ii|ƒ}d}|djpNt|idtiƒo’|djp't|idtiƒok|djo^t|iti ƒpt|iti ƒpt ‚|i i idd|id|iƒ}nJt|i|dtiƒo+|i i idd|id|iƒ}n|o!|ii||ƒ|d7}n|t|iƒjpt ‚|t|iƒdjodSn|}x“|t|iƒdjox|i}|idjoI|i i idd|iƒ}|ii|ii|ƒd|ƒdSn|ii|ƒ}qŠW|ii|ƒ|ii|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.(R&RRtNoneRRRttitletsubtitleRtsectiontAssertionErrorRRR(RR%tinsertRtsiblingR(RR&RR/R((R R'ds6[3 #(R R R RR R'(((R R#Fs  N( R t __docformat__tdocutilsRtdocutils.transformst TransformtTransformErrorRRR#(R4R3R0RRRR#((R t?s  #