
    k7i                         S r SrSSKJrJr  SSKJr  SSKJr  SSKJ	r	  SSK
Jr   " S S	\5      r " S
 S\5      r " S S\5      r " S S\5      rg)z 
Directives for document parts.
reStructuredText    )nodes	languages)parts)	Directive)
directives)BasePseudoSectionc                   z    \ rS rSrSrSrS rSrSr\	R                  \	R                  \\	R                  S.rS rS	rg
)Contents   av  
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nonec                 ^    [         R                  " U [        R                  5      nUS:X  a  g U$ )Nr   )r   choicer   backlinks_values)argvalues     _/home/james-whalen/.local/lib/python3.13/site-packages/docutils/parsers/rst/directives/parts.py	backlinksContents.backlinks    s)    !!#x'@'@AF?L       T)depthlocalr   classc                 x   [        U R                  R                  [        R                  5      (       a  U R                  SU R                  -  5      eU R                  R                  n[        R                  " UR                  R                  UR                  5      nU R                  (       aP  U R                  S   nU R                  R                  UU R                   5      u  pE["        R$                  " US/UQ76 nO9/ nSU R&                  ;   a  S nO$["        R$                  " SUR(                  S   5      n["        R*                  " S/S9nUS==   U R&                  R-                  S/ 5      -  ss'   U R                  R/                  5       u  Ul        Ul        U=R2                  S	-  sl        SU R&                  ;   a  US   R5                  S5        U(       a  UR7                  5       nXv-  nOUR(                  S   n["        R8                  " U5      nUR;                  U5      (       d  US
   R5                  U5        UR=                  U5        ["        R>                  " [@        RB                  U RD                  S9n	U	RF                  RI                  U R&                  5        URK                  U	5        Xy-  nU/U-   $ )NzBThe "%s" directive may not be used within topics or body elements.r    r   contents)classesr    r   r   names)	rawsource)&
isinstancestate_machinenoder	   invalid_parentserrornamedocumentr   get_languagesettingslanguage_codereporter	argumentsstateinline_textlinenor   titleoptionslabelstopicgetget_source_and_linesourcelineappendastextfully_normalize_namehas_namenote_implicit_targetpendingr   r   
block_textdetailsupdatenote_pending)
selfr)   language
title_text
text_nodesmessagesr2   r5   r(   r?   s
             r   runContents.run.   s,   d((--'779 9** 8:>))D E E%%..))(*;*;*I*I*2*;*;=>>*J#'::#9#9*:>++$G JKK
B<<EH$,,&B
(CDZL1iDLL,,Wb99#'#5#5#I#I#K ej

a
dll")##G,<<>DNE??:.D))$/  &&'N!!$'%%e,--$//Jt||,g&w!!r    N)__name__
__module____qualname____firstlineno____doc__r   r   optional_argumentsfinal_argument_whitespacer   nonnegative_intflagclass_optionoption_specrI   __static_attributes__rK   r   r   r   r      sJ     0  $&66&OO )&335K
'"r   r   c                   T    \ rS rSrSr\\\R                  \R                  S.rS r	Sr
g)SectnumX   zAutomatic section numbering.)r   startprefixsuffixc                     [         R                  " [        R                  5      nUR                  R                  U R                  5        U R                  R                  R                  U5        U/$ N)
r   r?   r   SectNumrA   rB   r3   r$   r)   rC   )rD   r?   s     r   rI   Sectnum.runa   sL    --.t||,##009yr   rK   N)rL   rM   rN   rO   rP   intr   unchanged_requiredrV   rI   rW   rK   r   r   rY   rY   X   s)    &'::'::<K
r   rY   c                   "    \ rS rSrSrSrS rSrg)Headerh   zContents of document header.Tc                     U R                  5         U R                  R                  R                  5       R	                  5       nU R
                  R                  U R                  U R                  U5        / $ r_   )	assert_has_contentr$   r)   get_decoration
get_headerr/   nested_parsecontentcontent_offset)rD   headers     r   rI   
Header.runn   V    !##,,;;=HHJ

d.A.A6J	r   rK   NrL   rM   rN   rO   rP   has_contentrI   rW   rK   r   r   re   re   h       &Kr   re   c                   "    \ rS rSrSrSrS rSrg)Footeru   zContents of document footer.Tc                     U R                  5         U R                  R                  R                  5       R	                  5       nU R
                  R                  U R                  U R                  U5        / $ r_   )	rh   r$   r)   ri   
get_footerr/   rk   rl   rm   )rD   footers     r   rI   
Footer.run{   rp   r   rK   Nrq   rK   r   r   ru   ru   u   rs   r   ru   N)rP   __docformat__docutilsr   r   docutils.transformsr   docutils.parsers.rstr   r   $docutils.parsers.rst.directives.bodyr	   r   rY   re   ru   rK   r   r   <module>r      sS   
 # % % * + BC"y C"Li  
Y 

Y 
r   