3 E\@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@eZdZdZd ZddZdZdZej ej eej d Z d d 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"tj|tj}|dkrdS|SdS)Nr )rchoicerbacklinks_values)argvaluer/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-install-emcbgzcf/docutils/docutils/parsers/rst/directives/parts.py backlinksszContents.backlinksT)depthlocalrclassc Cs|jjpt|jjtjs(|jd|j|jj}t j |j j |j }|jrz|jd}|jj||j\}}tj|df|}n&g}d|jkrd}ntjd|jd}tjdgd}|d|jjdg7<|jj\|_|_|jd 8_d|jkr|djd|r|j}||7}n |jd}tj|}|j|sH|d j||j|tjt j!|j"d } | j#j$|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)rr r )__name__ __module__ __qualname____doc__r rZoptional_argumentsZfinal_argument_whitespacerZnonnegative_intflagZ class_option option_specr3rrrrrs  rc@s*eZdZdZeeejejdZddZdS)SectnumzAutomatic section numbering.)rstartprefixsuffixcCs.tjtj}|jj|j|jjj ||gS)N) rr,rZSectNumr-r.r%rrr/)r0r,rrrr3`s z Sectnum.runN) r4r5r6r7intrZunchanged_requiredr9r3rrrrr:Ws  r:c@seZdZdZdZddZdS)HeaderzContents of document header.TcCs0|j|jjjj}|jj|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|j|jjjj}|jj|j|j|gS)N) r@rrrAZ get_footerr"rCrDrE)r0footerrrrr3zsz Footer.runN)r4r5r6r7rGr3rrrrrHtsrHN)r7Z __docformat__ZdocutilsrrZdocutils.transformsrZdocutils.parsers.rstrrrr:r?rHrrrrs   F