
    -Ph                         d Z dZddlmZmZ ddlmZ ddlmZ ddlm	Z	  G d de          Z
 G d	 d
e          Z G d de          Z G d de          ZdS )z 
Directives for document parts.
reStructuredText    )nodes	languages)parts)	Directive)
directivesc                   V    e Zd ZdZdZd ZdZdZej	        ej
        eej        dZ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.
    )topentrynonec                 T    t          j        | t          j                  }|dk    rd S |S )Nr   )r   choicer
   backlinks_values)argvalues     e/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/docutils/parsers/rst/directives/parts.py	backlinkszContents.backlinks   s*    !#x'@AAF??4L       T)depthlocalr   classc                    | j         j        sAt          | j         j        t          j                  s|                     d| j        z            | j         j        }t          j
        |j        j        |j                  }| j        rD| j        d         }| j                            || j                  \  }}t	          j        |dg|R  }n.g }d| j        v rd }n t	          j        d|j        d                   }t	          j        dg          }|dxx         | j                            dg           z  cc<   | j                                         \  |_        |_        |xj        d	z  c_        d| j        v r|d                             d           |r|                                }||z  }n|j        d         }t	          j        |          }|                    |          s|d
                             |           |                    |           t	          j        t@          j!        | j"                  }	|	j#        $                    | j                   |%                    |	           ||	z  }|g|z   S )NzBThe "%s" directive may not be used within topics or body elements.r    r   contents)classesr   r   r   names)	rawsource)&state_machinematch_titles
isinstancenoder   sidebarerrornamedocumentr   get_languagesettingslanguage_codereporter	argumentsstateinline_textlineno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messagesr0   r3   r&   r=   s
             r   runzContents.run-   su   "/ 	Ed05u}EE	E** 8:>)D E E E%.)(*;*I*2*;= => 
	E*J#':#9#9*:>+$G $G JK
B<<<<EEH$,&&B
(CDDZL111iDL,,Wb999#'#5#I#I#K#K ej

a

dl"")##G,,, 	/<<>>DUNEE?:.D)$//  && 	('N!!$'''%%e,,,-$/JJJt|,,,g&&&w!!r   N)__name__
__module____qualname____doc__r   r   optional_argumentsfinal_argument_whitespacer   nonnegative_intflagclass_optionoption_specrG    r   r   r
   r
      sr          0    $&6&O )&35 5K
'" '" '" '" '"r   r
   c                   :    e Zd ZdZeeej        ej        dZd ZdS )SectnumzAutomatic section numbering.)r   startprefixsuffixc                     t          j        t          j                  }|j                            | j                   | j        j        	                    |           |gS N)
r   r=   r   SectNumr?   r@   r1   r    r'   rA   )rB   r=   s     r   rG   zSectnum.run`   sM    -..t|,,,#00999yr   N)	rH   rI   rJ   rK   intr   unchanged_requiredrQ   rG   rR   r   r   rT   rT   W   sG        &&':':< <K
    r   rT   c                       e Zd ZdZdZd ZdS )HeaderzContents of document header.Tc                     |                                   | j        j                                                                        }| j                            | j        | j        |           g S rY   )	assert_has_contentr    r'   get_decoration
get_headerr-   nested_parsecontentcontent_offset)rB   headers     r   rG   z
Header.runm   [    !!!#,;;==HHJJ
d.A6JJJ	r   NrH   rI   rJ   rK   has_contentrG   rR   r   r   r^   r^   g   .        &&K    r   r^   c                       e Zd ZdZdZd ZdS )FooterzContents of document footer.Tc                     |                                   | j        j                                                                        }| j                            | j        | j        |           g S rY   )	r`   r    r'   ra   
get_footerr-   rc   rd   re   )rB   footers     r   rG   z
Footer.runz   rg   r   Nrh   rR   r   r   rl   rl   t   rj   r   rl   N)rK   __docformat__docutilsr   r   docutils.transformsr   docutils.parsers.rstr   r   r
   rT   r^   rl   rR   r   r   <module>rt      s  
  # % % % % % % % % % % % % % % * * * * * * + + + + + +C" C" C" C" C"y C" C" C"L    i    
 
 
 
 
Y 
 
 

 
 
 
 
Y 
 
 
 
 
r   