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__/universal.cpython-36.opt-1.pyc
3

�yY^+�@s�dZdZddlZddlZddlZddlmZmZddlm	Z	m
Z
ddlmZGdd�de
�Z
Gd	d
�d
e
�ZGdd�de
�ZGd
d�de
�ZGdd�de
�ZGdd�de
�ZGdd�de
�ZGdd�de
�ZdS)a+
Transforms needed by most or all documents:

- `Decorations`: Generate a document's header & footer.
- `Messages`: Placement of system messages stored in
  `nodes.document.transform_messages`.
- `TestMessages`: Like `Messages`, used on test runs.
- `FinalReferences`: Resolve remaining references.
�reStructuredText�N)�nodes�utils)�TransformError�	Transform)�smartquotesc@s,eZdZdZdZdd�Zdd�Zdd�Zd	S)
�DecorationszD
    Populate a document's decoration element (header, footer).
    i4cCsT|j�}|r(|jj�}|j�}|j|�|j�}|rP|jj�}|j�}|j|�dS)N)�generate_header�documentZget_decorationZ
get_header�extend�generate_footerZ
get_footer)�selfZheader_nodesZ
decoration�headerZfooter_nodesZfooter�r�/usr/lib/python3.6/universal.py�apply"s


zDecorations.applycCsdS)Nr)r
rrrr	.szDecorations.generate_headerc	Cs|jj}|js |js |js |jr�g}|jr0|js6|jrt|jrD|j}ntj|j	|j�}|j
tjdd|d�tj
d�g�|jr�tj|jtj��}|jtj
d|d��|jr�|j
tj
d�tjdddd�tj
d	�tjdd
dd�tj
d�g�tjd
|��gSdSdS)N�zView document source)Zrefuriz.
zGenerated on: z
Generated by ZDocutilsz http://docutils.sourceforge.net/z from rz(http://docutils.sourceforge.net/rst.htmlz	 source.
)rr)r
�settings�	generator�	datestampZsource_linkZ
source_url�_sourcerZ
relative_pathZ_destinationrrZ	reference�Text�timeZstrftimeZgmtime�appendZ	paragraph)r
r�text�sourcerrrrr1s6zDecorations.generate_footerN)�__name__�
__module__�__qualname__�__doc__�default_priorityrr	rrrrrrs
rc@s$eZdZdZdZdd�Zdd�ZdS)�ExposeInternalszL
    Expose internal attributes if ``expose_internals`` setting is set.
    iHcCst|tj�S)N)�
isinstancerr)r
�noderrr�not_Text`szExposeInternals.not_TextcCsZ|jjjrVxJ|jj|j�D]8}x2|jjjD]$}t||d�}|dk	r*||d|<q*WqWdS)Nz	internal:)r
rZexpose_internals�traverser$�getattr)r
r#Zatt�valuerrrrcs
zExposeInternals.applyN)rrrrr r$rrrrrr!Xsr!c@seZdZdZdZdd�ZdS)�Messageszi
    Place any system messages generated after parsing into a dedicated section
    of the document.
    i\cCs�|jj}|jjj}g}x*|D]"}|d|kr|jr|j|�qW|r�tjdgd�}|tjdd�7}||7}g|jjdd�<|j|7_dS)N�levelzsystem-messages)�classesrzDocutils System Messages)	r
�transform_messages�reporter�report_level�parentrr�section�title)r
Z
unfilteredZ	thresholdZmessages�msgr/rrrrus

zMessages.applyN)rrrrr rrrrrr(lsr(c@seZdZdZdZdd�ZdS)�FilterMessagesz;
    Remove system messages below verbosity threshold.
    ifcCs:x4|jjtj�D]"}|d|jjjkr|jj|�qWdS)Nr))r
r%rZsystem_messager,r-r.�remove)r
r#rrrr�szFilterMessages.applyN)rrrrr rrrrrr2�sr2c@seZdZdZdZdd�ZdS)�TestMessageszk
    Append all post-parse system messages to the end of the document.

    Used for testing purposes.
    ipcCs*x$|jjD]}|js
|j|7_q
WdS)N)r
r+r.)r
r1rrrr�szTestMessages.applyN)rrrrr rrrrrr4�sr4c@seZdZdZdZdd�ZdS)�
StripCommentszq
    Remove comment elements from the document tree (only if the
    ``strip_comments`` setting is enabled).
    i�cCs2|jjjr.x"|jjtj�D]}|jj|�qWdS)N)r
rZstrip_commentsr%rZcommentr.r3)r
r#rrrr�s
zStripComments.applyN)rrrrr rrrrrr5�sr5c@s$eZdZdZdZdd�Zdd�ZdS)�StripClassesAndElementsz�
    Remove from the document tree all elements with classes in
    `self.document.settings.strip_elements_with_classes` and all "classes"
    attribute values in `self.document.settings.strip_classes`.
    i�cCs||jjjp|jjjsdStdd�|jjjp,gD��|_tdd�|jjjpJgD��|_x"|jj|j�D]}|jj	|�qdWdS)NcSsg|]}|df�qS)Nr)�.0�keyrrr�
<listcomp>�sz1StripClassesAndElements.apply.<locals>.<listcomp>cSsg|]}|df�qS)Nr)r7r8rrrr9�s)
r
rZstrip_elements_with_classes�
strip_classes�dict�strip_elementsr%�
check_classesr.r3)r
r#rrrr�s


zStripClassesAndElements.applycCsPt|tj�rLx>|ddd�D]*}||jkr:|dj|�||jkrdSqWdS)Nr*�)r"rZElementr:r3r<)r
r#Zclass_valuerrrr=�s

z%StripClassesAndElements.check_classesN)rrrrr rr=rrrrr6�sr6c@sTeZdZdZdZejejfZej	ej
ejejej
fZdZdd�Zdd�Zdd	�Zd
S)�SmartQuotesz�
    Replace ASCII quotation marks with typographic form.

    Also replace multiple dashes with em-dash/en-dash characters.
    iRZqDecCstj|||d�t�|_dS)N)�	startnode)r�__init__�set�unsupported_languages)r
r
r@rrrrA�szSmartQuotes.__init__ccs<ddd�}x,|D]$}|t|j|j�}||j�fVqWdS)N�literalZplain)TF)r"r.�
literal_nodesZastext)r
�txtnodesZtexttype�txtnodeZnodetyperrr�
get_tokens�s

zSmartQuotes.get_tokenscCs�|jjj}|sdSy|jd�}Wntk
r8d}YnX|jjj}|jjj}|rdtjj	j
t|���x|jjt
j�D�]}t||j�r�qvt|jt
j�r�qvdd�|jt
j�D�}|j|�}|r�d|kr�|jdd�}n|d7}xVtj|�D]}|tjj	kr�|}Pq�W||jk�r$|jjjd||d�|jj|�d}tj|j|�|j|d	�}	x2t||	�D]$\}
}|
jj|
t
j||
jd
���qXWqvWt �|_dS)NZaltFcSsg|]}t|jtj�s|�qSr)r"r.rZ
option_string)r7rGrrrr9sz%SmartQuotes.apply.<locals>.<listcomp>z
-x-altquotrz*No smart quotes defined for language "%s".)Z	base_node)�attrZlanguage)�	rawsource)!r
r�smart_quotes�
startswith�AttributeErrorZ
language_codeZsmartquotes_localesrZ
smartcharsZquotes�updater;r%rZTextElementr"�
nodes_to_skipr.rZget_language_code�replacerZnormalize_language_tagrCr,Zwarning�addZeducate_tokensrH�smartquotes_action�ziprJrB)r
rK�alternativeZdocument_languageZlc_smartquotesr#rFZlang�tagZteacherrGZnewtextrrrr�sJ





zSmartQuotes.applyN)rrrrr rZFixedTextElement�SpecialrOZimagerDZmath�rawZproblematicrErRrArHrrrrrr?�sr?)rZ
__docformat__�re�sysrZdocutilsrrZdocutils.transformsrrZdocutils.utilsrrr!r(r2r4r5r6r?rrrr�<module>s>"