
    O&i                         d Z ddlmZmZmZ ddlmZ ddlmZ ddl	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  ej        e          ZdedefdZdededdfdZdedeeef         fdZdS )z7Allow reference sections by :ref: role using its title.    )AnyDictcast)nodes)NodeN)Sphinx)StandardDomain)__)logging)clean_astextnodereturnc                 f    d}| }|j         | j        k    r|j         }|dz  }|j         | j        k    |S )Nr      )parentdocument)r   icur_nodes      h/home/geonatureadmin/si_en_reseau/tutos/venv/lib/python3.11/site-packages/sphinx/ext/autosectionlabel.pyget_node_depthr      sC    	AH
/T]
*
*?	Q /T]
*
* H    appr   c           	         t          t          | j                            d                    }|                    t
          j                  D ]y}| j        j        rt          |          | j        j        k    r-|d         d         }| j        j
        }t          t
          j        |d                   }t          |d|                                          }| j        j        rt          j        |dz   |z             }nt          j        |          }t!          |          }	t"                              t'          d          |||d|           ||j        v rVt"                              t'          d	          || j                            |j        |         d                   |d|           ||f|j        |<   |||	f|j        |<   {d S )
Nstdidsr   	rawsource:z!section "%s" gets labeled as "%s"autosectionlabel)locationtypesubtypez(duplicate label %s, other instance in %s)r   r	   env
get_domainfindallr   sectionconfigautosectionlabel_maxdepthr   docnametitlegetattrastext autosectionlabel_prefix_documentfully_normalize_namer   loggerdebugr
   labelswarningdoc2path
anonlabels)
r   r   domainr   labelidr(   r)   ref_namenamesectnames
             r   register_sections_as_labelr9      s   .#'"4"4U";";<<F  // 9 9J0 	t$$
(LLLu+a.'/U[$q'**5+u||~~>>:6 	8-gmh.FGGDD-h77D&&R;<<t");W 	 	N 	N 	N 6=  NN2HII!1!1&-2Ea2H!I!I$(/A7  T T T #*7"2$%w8d/9 9r   c                     |                      ddd           |                      dd d           |                     dt                     t          j        dddS )Nr,   Fr"   r'   zdoctree-readT)versionparallel_read_safeparallel_write_safe)add_config_valueconnectr9   sphinx__display_version__)r   s    r   setuprB   7   sf    ;UEJJJ4dEBBBKK :;;; -"#  r   )__doc__typingr   r   r   docutilsr   docutils.nodesr   r@   sphinx.applicationr   sphinx.domains.stdr	   sphinx.localer
   sphinx.utilr   sphinx.util.nodesr   	getLogger__name__r.   intr   r9   strrB    r   r   <module>rQ      sA   = = " " " " " " " " " "              % % % % % % - - - - - -             * * * * * *		8	$	$ #    9F 9d 9t 9 9 9 98	v 	$sCx. 	 	 	 	 	 	r   