B “äî\›ã@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úI/tmp/pip-build-uw_ogi45/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_codeZreporterZ 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_specr2rrrrrs  rc@s*eZdZdZeeejejdœZdd„ZdS)ÚSectnumzAutomatic section numbering.)rÚstartÚprefixÚsuffixcCs.t tj¡}|j |j¡|jj  |¡|gS)N) rr+rZSectNumr,r-r$rrr.)r/r+rrrr2`s z Sectnum.runN) r3r4r5r6ÚintrZunchanged_requiredr8r2rrrrr9Ws  r9c@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)r/Úheaderrrrr2msz Header.runN)r3r4r5r6Ú has_contentr2rrrrr>gsr>c@seZdZdZdZdd„ZdS)ÚFooterzContents of document footer.TcCs0| ¡|jj ¡ ¡}|j |j|j|¡gS)N) r?rrr@Z get_footerr!rBrCrD)r/Úfooterrrrr2zsz Footer.runN)r3r4r5r6rFr2rrrrrGtsrGN)r6Z __docformat__ZdocutilsrrZdocutils.transformsrZdocutils.parsers.rstrrrr9r>rGrrrrÚs   F