m๒ u๕Oc@sdZdZdkZdkZdklZlZdklZl Z de fd„ƒYZ de fd„ƒYZ d ei fd „ƒYZ dS( s' Transforms related to document parts. treStructuredTextN(snodessutils(sTransformErrors TransformtSectNumcBs,tZdZdZd„Zfdd„ZRS(sS Automatically assigns numbers to the titles of document sections. It is possible to limit the maximum section level for which the numbers are added. For those sections that are auto-numbered, the "autonum" attribute is set, informing the contents table generator that a different form of the TOC should be used. iฦcCs|iiiddƒ|_|iiiddƒ|_|iiiddƒ|_|iiiddƒ|_|ii i |iƒ|i i i o4|idjoti|_n|i|i ƒnI|i|i i _|i|i i _|i|i i _|i|i i _dS(Ntdepthtstartitprefixttsuffix(tselft startnodetdetailstgettNonetmaxdeptht startvalueRRtparenttremovetdocumenttsettingst sectnum_xformtsystmaxinttupdate_section_numberst sectnum_deptht sectnum_starttsectnum_prefixtsectnum_suffix(R((ts/home/project-web/docutils/web-update/infrastructure/update-dir/aux/snapshots/docutils/docutils/transforms/parts.pytapply sic Cs๒|d7}|o d}n |i}xว|D]ฟ}t|ti ƒoฆ|t |ƒf}|d}ti d|idi|ƒ|iddddgƒ}|id|ƒd|d <||ijo|i|||ƒn|d7}q+q+WdS( NiiRt.uย itclassestsectnumtauto(RRRRR tnodetchildt isinstancetnodestsectiontstrtnumbersttitlet generatedtjoinRtinsertR R( RR RRR'RR&R!R(((RR0s     + (t__name__t __module__t__doc__tdefault_priorityRR(((RRs  tContentscBs2tZdZdZd„Zdd„Zd„ZRS(s่ This transform generates a table of contents from the entire document tree or from a single branch. It locates "section" elements and builds them into a nested bullet list, which is placed within a "topic" created by the contents directive. A title is either explicitly specified, taken from the appropriate language module, or omitted (local table of contents). The depth may be specified. Two-way references between the table of contents and section titles are generated (requires Writer support). This transform requires a startnode, which contains generation options and provides the location for the generated table of contents (the startnode is replaced by the table of contents "topic"). iะcCsiy|iii}Wntj o t}nX|ii}d|joJ|ii i }xAt |t i ƒpt |t iƒp |i }qZWn |i}|ii dd|_ d|jo|d|_n|iii|_|o0|ii ii|ƒ|ii i|iƒnM|i|ƒ}t|ƒo|ii|ƒn|ii i i|ii ƒdS(Ntlocaltidsit backlinks(RRRt use_latex_toct toc_by_writertAttributeErrortFalseRR RR"R#R$ttoc_idR2t toc_backlinkst attributestupdateRtbuild_contentstcontentstlent replace_self(RRR4R R<((RRXs,   &   icCs้|d7}g} |D]$}t|tiƒo | |qq~ } g} d}|i i i dtiƒ}x8| D]0}|d}|i dƒ} |i|ƒ}tiddd|dd|Œ}|ii|ƒ}tidd|ƒ}tid|ƒ} |id jo\|itiƒdjoC|idjo||d|idƒo!|iiti|dƒƒnti‚dS(Ntalt(R thasattrRRRRR#tTextRZ(RR ((Rt visit_imageฉs!cCs ti‚dS(N(R#t SkipDeparture(RR ((Rt ignore_node_but_process_childrenฎs( R+R,RWR[R\R`Rbtvisit_interpretedtvisit_problematictvisit_referencet visit_target(((RRTžs     (R-t __docformat__treRtdocutilsR#tutilstdocutils.transformstTransformErrort TransformRR/tTreeCopyVisitorRT( RlRjRRmRgRRhR#RTR/((Rt?s  4X