HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/docutils/transforms/__pycache__/parts.cpython-36.pyc
3

v2�eE�@sndZdZddlZddlZddlmZmZddlmZm	Z	Gdd�de	�Z
Gdd	�d	e	�ZGd
d�dej�Z
dS)z'
Transforms related to document parts.
ZreStructuredText�N)�nodes�utils)�TransformError�	Transformc@s*eZdZdZdZdd�Zfdfdd�ZdS)	�SectNumaS
    Automatically assigns numbers to the titles of document sections.

    It is possible to limit the maximum section level for which the numbers
    are added.  For those sections that are auto-numbered, the "autonum"
    attribute is set, informing the contents table generator that a different
    form of the TOC should be used.
    i�cCs�|jjjdd�|_|jjjdd�|_|jjjdd�|_|jjjdd�|_|jjj|j�|j	j
jr�|jdkrttj
|_|j|j	�n0|j|j	j
_|j|j	j
_|j|j	j
_|j|j	j
_dS)N�depth�start��prefix��suffix)�	startnode�details�get�maxdepth�
startvaluer
r�parent�remove�document�settingsZ
sectnum_xform�sys�maxsize�update_section_numbersZ
sectnum_depthZ
sectnum_startZsectnum_prefixZsectnum_suffix)�self�r�/usr/lib/python3.6/parts.py�apply s

z
SectNum.applyrc	Cs�|d7}|rd}n|j}x�|D]�}t|tj�r|t|�f}|d}tjd|jdj|�|jd
dgd�}|j	d|�d|d	<||j
kr�|j|||�|d7}qWdS)Nr	rr�.� ��sectnum)�classes�autou   )r�
isinstancer�section�str�	generatedr
�joinr�insertrr)	r�noder
rr ZchildZnumbers�titler&rrrr0s"


zSectNum.update_section_numbersN)�__name__�
__module__�__qualname__�__doc__�default_priorityrrrrrrrs	rc@s.eZdZdZdZdd�Zddd�Zdd	�Zd
S)�Contentsa�
    This transform generates a table of contents from the entire document tree
    or from a single branch.  It locates "section" elements and builds them
    into a nested bullet list, which is placed within a "topic" created by the
    contents directive.  A title is either explicitly specified, taken from
    the appropriate language module, or omitted (local table of contents).
    The depth may be specified.  Two-way references between the table of
    contents and section titles are generated (requires Writer support).

    This transform requires a startnode, which contains generation
    options and provides the location for the generated table of contents (the
    startnode is replaced by the table of contents "topic").
    i�cCs�y|jjj}Wntk
r&d}YnX|jj}d|krh|jjj}x*t|tj	�pZt|tj�sd|j}qDWn|j}|jjdd|_
d|kr�|d|_n|jjj|_|r�|jjj
j|�|jjj|j�n4|j|�}t|�r�|jj|�n|jjjj|jj�dS)NFZlocal�idsr�	backlinks)rrZ
use_latex_toc�AttributeErrorr
rrr#rr$�toc_idr2Z
toc_backlinksZ
attributes�updater�build_contents�lenZreplace_self)rZ
toc_by_writerrr
�contentsrrrrXs,


zContents.applyrcCs8|d7}dd�|D�}g}d}|jjjdtj�}x�|D]�}|d}|jd�}	|j|�}
tjd|
�d|d	di�}|jj	|�}tj
dd|�}
tjd|
�}|jdkr�|j
tj�dkr�|jd
kr�||d<n|jdkr�|j|d<||kr�|j||�}||7}|j|�q6W|�r0tjd|��}|	�r,|djd
�|SgSdS)Nr	cSsg|]}t|tj�r|�qSr)r#rr$)�.0Zsectrrr�
<listcomp>xsz+Contents.build_contents.<locals>.<listcomp>rrr"rZrefidr1�entry�topr!zauto-toc)rr)r;r<)r)r
rrrr�copy_and_filterr�	referencerZset_idZ	paragraphZ	list_itemr2Z	next_noder4r6�appendZbullet_list)rr)�levelZsectionsZentriesZautonumrr$r*r"Z	entrytextr>Zref_idr;�itemZsubsectsr8rrrr6vs<







zContents.build_contentscCst|j�}|j|�|j�S)z@Return a copy of a title, with references, images, etc. removed.)�ContentsFilterrZ	walkabout�get_entry_text)rr)Zvisitorrrrr=�s

zContents.copy_and_filterN)r)r+r,r-r.r/rr6r=rrrrr0Fs

!r0c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZeZeZ	eZ
eZdS)rBcCs
|j�jS)N)Z
get_tree_copyZchildren)rrrrrC�szContentsFilter.get_entry_textcCs
tj�dS)N)r�SkipNode)rr)rrr�visit_citation_reference�sz'ContentsFilter.visit_citation_referencecCs
tj�dS)N)rrD)rr)rrr�visit_footnote_reference�sz'ContentsFilter.visit_footnote_referencecCs*|jd�r |jjtj|d��tj�dS)NZalt)�hasattrrr?rZTextrD)rr)rrr�visit_image�s
zContentsFilter.visit_imagecCs
tj�dS)N)rZ
SkipDeparture)rr)rrr� ignore_node_but_process_children�sz/ContentsFilter.ignore_node_but_process_childrenN)r+r,r-rCrErFrHrIZvisit_interpretedZvisit_problematicZvisit_referenceZvisit_targetrrrrrB�srB)r.Z
__docformat__�rerZdocutilsrrZdocutils.transformsrrrr0ZTreeCopyVisitorrBrrrr�<module>s4X