
    O&iG                         d Z ddlmZmZmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ  G d d	e          Zd
edeeef         fdZdS )z6The title collector components for sphinx.environment.    )AnyDictSet)nodes)Sphinx)BuildEnvironment)EnvironmentCollector)SphinxContentsFilterc            
       p    e Zd ZdZdedededdfdZdededee         d	eddf
d
Z	dede
j        ddfdZdS )TitleCollectorz'title collector for sphinx.environment.appenvdocnamereturnNc                 r    |j                             |d            |j                            |d            d S N)titlespop
longtitles)selfr   r   r   s       p/home/geonatureadmin/si_en_reseau/tutos/venv/lib/python3.11/site-packages/sphinx/environment/collectors/title.py	clear_doczTitleCollector.clear_doc   s6    
w%%%7D)))))    docnamesotherc                 d    |D ],}|j         |         |j         |<   |j        |         |j        |<   -d S r   )r   r   )r   r   r   r   r   r   s         r   merge_otherzTitleCollector.merge_other   sI     	@ 	@G"',w"7CJw&+&6w&?CN7##	@ 	@r   doctreec                    t          j                    }|}d|v r0t          j                    }|t          j        |d                   z  }|                    t           j                  D ]D}t          |          }|d                             |           ||                                z  } n+|t          j        |                    dd                    z  }||j	        j
        |j	        j        <   ||j	        j        |j	        j        <   dS )zAdd a title node to the document (just copy the first section title),
        and store that title in the environment.
        titler   z
<no title>N)r   r    Textfindallsectionr
   	walkaboutget_entry_textgetr   r   r   r   )r   r   r   	titlenodelongtitlenodenodevisitors          r   process_doczTitleCollector.process_doc   s     KMM	! g!KMMMUZ(8999MOOEM22 	H 	HD*733GGg&&&//111IE GKK$F$FGGGI*3sw'.;37?+++r   )__name__
__module____qualname____doc__r   r   strr   r   r   r   documentr+    r   r   r   r      s        11*V **: *S *T * * * *@v @,< @!#h@/?@DH@ @ @ @<v < <4 < < < < < <r   r   r   r   c                 B    |                      t                     ddddS )NbuiltinT)versionparallel_read_safeparallel_write_safe)add_env_collectorr   )r   s    r   setupr9   2   s0    .))) "#  r   N)r/   typingr   r   r   docutilsr   sphinx.applicationr   sphinx.environmentr   sphinx.environment.collectorsr	   sphinx.transformsr
   r   r0   r9   r2   r   r   <module>r@      s    < < ! ! ! ! ! ! ! ! ! !       % % % % % % / / / / / / > > > > > > 2 2 2 2 2 2"< "< "< "< "<) "< "< "<Jv $sCx.      r   