B ¡w­\›ã@s€dZdZddlmZmZddlmZddlmZddlm Z Gdd„deƒZ Gd d „d eƒZ Gd d „d eƒZ Gd d„deƒZ dS)z Directives for document parts. ZreStructuredTexté)ÚnodesÚ languages)Úparts)Ú Directive)Ú directivesc@s@eZdZdZdZdd„ZdZdZej ej eej dœZ 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. )ÚtopÚentryÚnonecCs"t |tj¡}|dkrdS|SdS)Nr )rÚchoicerÚbacklinks_values)ÚargÚvalue©rú/private/var/folders/j5/hv2kzfgs4sl6jnf70fy_2vrc4p3c_b/T/pip-install-d8kq1y21/docutils/docutils/parsers/rst/directives/parts.pyÚ backlinksszContents.backlinkséT)ÚdepthÚlocalrÚclassc CsŽ|jjs(t|jjtjƒs(| d|j¡‚|jj}t   |j j |j ¡}|jrz|jd}|j ||j¡\}}tj|df|žŽ}n&g}d|jkrŽd}nt d|jd¡}tjdgd}|d|j dg¡7<|j ¡\|_|_|jd 8_d|jkr|d d¡|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.rÚrÚcontents)ÚclassesrrrÚnames)Z rawsource)&Ú state_machineZ match_titlesÚ isinstanceÚnoderZsidebarÚerrorÚnameÚdocumentrZ get_languageÚsettingsZ language_codeZreporterÚ argumentsÚstateZ inline_textÚlinenoÚtitleÚoptionsÚlabelsÚtopicÚgetZget_source_and_lineÚsourceÚlineÚappendZastextZfully_normalize_nameZhas_nameZnote_implicit_targetÚpendingrrZ block_textÚdetailsÚupdateÚ note_pending) ÚselfrÚlanguageZ title_textZ text_nodesÚmessagesr$r'rr,rrrÚrun-sF            z Contents.runN)Ú__name__Ú __module__Ú __qualname__Ú__doc__r rZoptional_argumentsZfinal_argument_whitespacerZnonnegative_intÚflagZ class_optionÚ option_specr3rrrrrs  rc@s*eZdZdZeeejejdœZdd„ZdS)ÚSectnumzAutomatic section numbering.)rÚstartÚprefixÚsuffixcCs.t tj¡}|j |j¡|jj  |¡|gS)N) rr,rZSectNumr-r.r%rrr/)r0r,rrrr3`s z Sectnum.runN) r4r5r6r7ÚintrZunchanged_requiredr9r3rrrrr:Ws  r:c@seZdZdZdZdd„ZdS)ÚHeaderzContents of document header.TcCs0| ¡|jj ¡ ¡}|j |j|j|¡gS)N) Úassert_has_contentrrÚget_decorationÚ get_headerr"Ú nested_parseÚcontentÚcontent_offset)r0Úheaderrrrr3msz Header.runN)r4r5r6r7Ú has_contentr3rrrrr?gsr?c@seZdZdZdZdd„ZdS)ÚFooterzContents of document footer.TcCs0| ¡|jj ¡ ¡}|j |j|j|¡gS)N) r@rrrAZ get_footerr"rCrDrE)r0Úfooterrrrr3zsz Footer.runN)r4r5r6r7rGr3rrrrrHtsrHN)r7Z __docformat__ZdocutilsrrZdocutils.transformsrZdocutils.parsers.rstrrrr:r?rHrrrrÚs   F