mò hã¸Ec@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((t7/data/zmath/zope/lib/python/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 bscCs6|ii|ƒ}d}|djpNt|idtiƒo‰|djp't|idtiƒob|djoUt|iti ƒpt|iti ƒpt ‚|i i idd|iƒ}nAt|i|dtiƒo"|i i idd|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|ƒ}qxW|ii|ƒ|ii|d|ƒdS(Niiis4Document or section may not begin with a transition.RsZAt least one body element must separate transitions; adjacent transitions are not allowed.s'Document may not end with a transition.(R&RRtNoneRRRttitletsubtitleRtsectiontAssertionErrorRRRR%tinsertRtsiblingR(RR&RR.R((R R'fs6[3 #(R R R RR R'(((R R#Hs  N( R t __docformat__tdocutilsRtdocutils.transformst TransformtTransformErrorRRR#(R3R2R/RRRR#((R t? s  #