ó V!¶\c@s'dZdZddlZddlZddlZddlZddlmZmZm Z ddlm Z m Z ddl m Z mZddl mZmZmZde fd „ƒYZd e fd „ƒYZd e fd „ƒYZde fd„ƒYZdejfd„ƒYZdZdd„ZdS(sø Transforms for PEP processing. - `Headers`: Used to transform a PEP's initial RFC-2822 header. It remains a field list, but some entries get processed. - `Contents`: Auto-inserts a table of contents. - `PEPZero`: Special processing for PEP 0. treStructuredTextiÿÿÿÿN(tnodestutilst languages(tApplicationErrort DataError(t TransformtTransformError(tpartst referencestmisctHeaderscBsYeZdZdZdZdZejdejƒdfejdƒdffZ d„Z RS(s< Process fields in a PEP's initial RFC-2822 header. ihspep-%04ds3http://hg.python.org/peps/file/default/pep-%04d.txts\$RCSfile: (.+),v \$$s\1s\$[a-zA-Z]+: (.+) \$$c Csbt|jƒstdƒ‚n|jd}t|tjƒ sNd|dkr]tdƒ‚nd}x-|D]%}|djƒjƒdkrj|djƒ}yt |ƒ}|j |}WnÏt k rŠ|}d}|jj j d|d |ƒ}|jj|ƒ}tj||pd d |ƒ}|jj|ƒ} |j| ƒt|dƒrh|g|dd(q‹|dctjd d |ƒ7R#R9tcompilet IGNORECASER@RU(((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pyR stContentscBseZdZdZd„ZRS(s~ Insert an empty table of contents topic and a transform placeholder into the document after the RFC 2822 header. i|cCsãtj|jjj|jjƒ}|jd}tjd|ƒ}tj d|ddgƒ}tj |ƒ}|jj |ƒs|dj |ƒn|jj |ƒtjtjƒ}||7}|jjd|ƒ|jj|ƒdS(NtcontentsRR tnamesi(Rt get_languageRR<t language_codeR%tlabelsRRttopictfully_normalize_namethas_nameR;tnote_implicit_targetR+RR\R-R.(RAtlanguageRJRRbR+((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pyRU’s  (RVRWRXRYRU(((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pyR\‰st TargetNotescBs&eZdZdZd„Zd„ZRS(s¶ Locate the "References" section, insert a placeholder for an external target footnote insertion transform at the end, and schedule the transform to run immediately. icCs{|j}t|ƒd}d}}x|dkr¤t||tjƒr¤||djƒjƒjƒ}d|kr‚||}Pnd|kr—|}n|d8}q&W|stjƒ}|tj ddƒ7}|j |ƒ|ró|j ||ƒq|j |ƒntj tjƒ}|j |ƒ|jj|dƒtj tjdi|jd6ƒ}|j |ƒ|jj|dƒdS( NiiR t copyrightRt Referencestdetailstcallback(RRRRRtsectionR R!R:RR'R-R;R+R RgR.R tCallBacktcleanup_callback(RAtdoctitrefsectRht title_wordsR+((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pyRU¬s2  %         cCs2t|jƒdkr.|jjj|jƒndS(s Remove an empty "References" section. Called after the `references.TargetNotes` transform is complete. iN(Rtparenttremove(RAR+((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pyRnÊs(RVRWRXRYRURn(((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pyRg¢s R,cBseZdZdZd„ZRS(s' Special processing for PEP 0. iøcCs9t|jƒ}|jj|ƒ|jjj|jƒdS(N(tPEPZeroSpecialRtwalkt startnodeRsRt(RAtvisitor((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pyRUÜs(RVRWRXRYRU(((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pyR,ÔsRucBsVeZdZejZd„Zd„Zd„Zd„Zd„Z d„Z d„Z RS(s´ Perform the special processing needed by PEP 0: - Mask email addresses. - Link PEP numbers in the second column of 4-column tables to the PEPs themselves. cCsdS(N((RARN((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pyt unknown_visitïscCs|jt|ƒƒdS(N(R6R7(RARN((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pytvisit_referenceòscCs d|dkrtj‚ndS(NR R (RtSkipNode(RARN((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pytvisit_field_listõscCs |ddk|_d|_dS(Ntcolsii(t pep_tabletentry(RARN((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pyt visit_tgroupùscCs?|jd7_|jr;|jdkr;|djdƒndS(NiiR tnum(RR~R;(RARN((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pyt visit_colspecýscCs d|_dS(Ni(R(RARN((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pyt visit_rowscCsè|jd7_|jrä|jdkrät|ƒdkrä|djdƒ|d}t|tjƒrät|ƒdkrä|jƒ}yFt|ƒ}|j j j |j |}tj ||d|ƒ|dR5R$(RARNtpttextRtref((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pyt visit_entrys* $     ( RVRWRXR R>RyRzR|R€R‚RƒR‡(((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pyRuâs        speps@python.orgspython-list@python.orgspython-dev@python.orgcCs°|jdƒr¨|djdƒr¨|ddtkrC|d}n0|jƒjddƒ}tjd|dd ƒ}|d krƒ|S|dcd |7<|g|(|Sn|Sd S( s¨ Mask the email address in `ref` and return a replacement node. `ref` is returned unchanged if it contains no email address. For email addresses such as "user@host", mask the address as "user at host" (text) to thwart simple email address harvesters (except for those listed in `non_masked_addresses`). If a PEP number (`pepno`) is given, return a reference including a default email subject. Rsmailto:iit@s at Rtformatthtmls?subject=PEP%%20%sN(thasattrt startswithtnon_masked_addressesR treplaceRtrawR(R†RRt replacementtreplacement_text((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pyR7s "   (speps@python.orgspython-list@python.orgspython-dev@python.org(RXt __docformat__tsysR3R9R0tdocutilsRRRRRtdocutils.transformsRRRR R R R\RgR,tSparseNodeVisitorRuRRR7(((s</tmp/pip-install-usGedi/docutils/docutils/transforms/peps.pyt s$    o23