B 0`@sdZdZddlmZmZddlmZddlmZddlm Z GdddeZ Gd d d eZ Gd d d eZ Gd ddeZ dS)z Directives for document parts. ZreStructuredText)nodes languages)parts) Directive) directivesc@s@eZdZdZdZddZdZdZej ej eej dZ dd Z d S) Contentsa Table of contents. The table of contents is generated in two passes: initial parse and transform. During the initial parse, a 'pending' element is generated which acts as a placeholder, storing the TOC title and any options internally. At a later stage in the processing, the 'pending' element is replaced by a 'topic' element, a title and the table of contents proper. )topentrynonecCs"t|tj}|dkrdS|SdS)Nr )rchoicerbacklinks_values)argvaluer/private/var/folders/sf/wxz_36012wxg_prv29r6623x5vlqx8/T/pip-target-tft40_m7/lib/python/docutils/parsers/rst/directives/parts.py backlinksszContents.backlinksT)depthlocalrclassc Cs|jjs(t|jjtjs(|d|j|jj}t |j j |j }|jrz|jd}|j||j\}}tj|df|}n&g}d|jkrd}ntd|jd}tjdgd}|d|jdg7<|j\|_|_|jd 8_d|jkr|dd|r|}||7}n |jd}t|}||sH|d |||tjt j!|j"d } | j#$|j|%| || 7}|g|S) NzBThe "%s" directive may not be used within topics or body elements.rrcontents)classesrrrnames)Z rawsource)& state_machineZ match_titles isinstancenoderZsidebarerrornamedocumentrZ get_languagesettingsZ language_codeZreporter argumentsstateZ inline_textlinenotitleoptionslabelstopicgetZget_source_and_linesourcelineappendZastextZfully_normalize_nameZhas_nameZnote_implicit_targetpendingrrZ block_textdetailsupdate note_pending) selfrlanguageZ title_textZ text_nodesmessagesr$r'rr,rrrrun-sF            z Contents.runN)__name__ __module__ __qualname____doc__r rZoptional_argumentsZfinal_argument_whitespacerZnonnegative_intflagZ class_option option_specr3rrrrrs  rc@s*eZdZdZeeejejdZddZdS)SectnumzAutomatic section numbering.)rstartprefixsuffixcCs.ttj}|j|j|jj ||gS)N) rr,rZSectNumr-r.r%rrr/)r0r,rrrr3`s z Sectnum.runN) r4r5r6r7intrZunchanged_requiredr9r3rrrrr:Ws  r:c@seZdZdZdZddZdS)HeaderzContents of document header.TcCs0||jj}|j|j|j|gS)N) assert_has_contentrrget_decoration get_headerr" nested_parsecontentcontent_offset)r0headerrrrr3msz Header.runN)r4r5r6r7 has_contentr3rrrrr?gsr?c@seZdZdZdZddZdS)FooterzContents of document footer.TcCs0||jj}|j|j|j|gS)N) r@rrrAZ get_footerr"rCrDrE)r0footerrrrr3zsz Footer.runN)r4r5r6r7rGr3rrrrrHtsrHN)r7Z __docformat__ZdocutilsrrZdocutils.transformsrZdocutils.parsers.rstrrrr:r?rHrrrrs   F