HEX
Server: Apache
System: Linux srv1.prosuiteplus.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: prosuiteplus (1001)
PHP: 8.3.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/docutils/transforms/__pycache__/universal.cpython-38.pyc
U

�?�]t,�@s�dZdZddlZddlZddlZddlmZmZddlm	Z	m
Z
ddlmZej
dkrZeZGdd	�d	e
�ZGd
d�de
�ZGdd
�d
e
�ZGdd�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)�smartquotes)�rc@s,eZdZdZdZdd�Zdd�Zdd�Zd	S)
�DecorationszD
    Populate a document's decoration element (header, footer).
    i4cCsT|��}|r(|j��}|��}|�|�|��}|rP|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/dist-packages/docutils/transforms/universal.py�apply's


zDecorations.applycCsdSr
r)rrrrr3szDecorations.generate_headerc
Cs|jj}|js |js |js |jr�g}|jr0|js6|jrt|jrD|j}nt�|j	|j�}|�
tjdd|d�t�
d�g�|jr�t�|jt���}|�t�
d|d��|jr�|�
t�
d�tjdddd�t�
d	�tjdd
dd�t�
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_urlZ_sourcer�
relative_pathZ_destinationr
rZ	reference�Text�time�strftime�gmtime�appendZ	paragraph)rr�text�sourcerrrrr6sD�������zDecorations.generate_footerN)�__name__�
__module__�__qualname__�__doc__�default_priorityrrrrrrrr	s
r	c@s$eZdZdZdZdd�Zdd�ZdS)�ExposeInternalszL
    Expose internal attributes if ``expose_internals`` setting is set.
    iHcCst|tj�Sr
)�
isinstancerr�r�noderrr�not_TexteszExposeInternals.not_TextcCsR|jjjrN|j�|j�D]4}|jjjD]$}t||d�}|dk	r&||d|<q&qdS)Nz	internal:)rrZexpose_internals�traverser)�getattr)rr(Zatt�valuerrrrhs
zExposeInternals.applyN)r r!r"r#r$r)rrrrrr%]sr%c@seZdZdZdZdd�ZdS)�Messageszi
    Place any system messages generated after parsing into a dedicated section
    of the document.
    i\cCs�|jj}|jjj}g}|D] }|d|kr|js|�|�q|r�tjdgd�}|t�dd�7}||7}g|jjdd�<|j|7_dS)N�levelzsystem-messages)�classesrzDocutils System Messages)	r�transform_messages�reporter�report_level�parentrr�section�title)rZ
unfilteredZ	thresholdZmessages�msgr4rrrrzs
zMessages.applyN�r r!r"r#r$rrrrrr-qsr-c@seZdZdZdZdd�ZdS)�FilterMessagesz;
    Remove system messages below verbosity threshold.
    ifcCs:t|j�tj��D]"}|d|jjjkr|j�|�qdS)Nr.)	�tuplerr*rZsystem_messager1r2r3�remover'rrrr�szFilterMessages.applyNr7rrrrr8�sr8c@seZdZdZdZdd�ZdS)�TestMessageszk
    Append all post-parse system messages to the end of the document.

    Used for testing purposes.
    ipcCs&|jjD]}|js|j|7_qdSr
)rr0r3)rr6rrrr�szTestMessages.applyNr7rrrrr;�sr;c@seZdZdZdZdd�ZdS)�
StripCommentszq
    Remove comment elements from the document tree (only if the
    ``strip_comments`` setting is enabled).
    i�cCs2|jjjr.t|j�tj��D]}|j�|�qdSr
)	rrZstrip_commentsr9r*rZcommentr3r:r'rrrr�s
zStripComments.applyNr7rrrrr<�sr<c@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�c
Cs�|jjjr>t|jjj�|_t|j�|j��D]}|j�	|�q,|jjj
sLdS|jjj
}|j�tj�D]6}|D],}z|d�	|�Wqlt
k
r�YqlXqlqddS)Nr/)rrZstrip_elements_with_classes�set�strip_elementsr9r*�
check_classesr3r:�
strip_classesr�Element�
ValueError)rr(rA�class_valuerrrr�s
�

zStripClassesAndElements.applycCs:t|tj�sdS|ddd�D]}||jkr dSq dS)NFr/T)r&rrBr?)rr(rDrrrr@�s
z%StripClassesAndElements.check_classesN)r r!r"r#r$rr@rrrrr=�sr=c@s\eZdZdZdZejejfZejejej	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__r>�unsupported_languages)rrrFrrrrG�szSmartQuotes.__init__ccsX|D]N}t|j|j�s&t|jj|j�r6dt|�fVqt�ddt|��}d|fVqdS)N�literalz(?<=)([-\'".`])z\\\1Zplain)r&r3�
literal_nodes�unicode�re�sub)r�txtnodesr(Ztxtrrr�
get_tokens�s�zSmartQuotes.get_tokensc	Cs�|jjj}|sdSz|�d�}Wntk
r8d}YnX|jjj}|jjj}|rdtjj	�
t|��|j�t
j�D�]}t||j�r�qrt|jt
j�r�qrdd�|�t
j�D�}|�|�}|r�d|kr�|�dd�}n|d7}t�|�D]}|tjj	kr�|}�q0q�||jk�r |jjjd||d�|j�|�d}tj|�|�|j|d	�}	t||	�D]$\}
}|
j�|
t
j||
jd
���qRqrt �|_dS)NZaltFcSsg|]}t|jtj�s|�qSr)r&r3rZ
option_string)�.0�txtnoderrr�
<listcomp>s
��z%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�update�dictr*rZTextElementr&�
nodes_to_skipr3rZget_language_code�replacerZnormalize_language_tagrHr1Zwarning�addZeducate_tokensrO�smartquotes_action�ziprTr>)rrUZalternativeZdocument_languageZlc_smartquotesr(rNZlang�tagZteacherrQZnewtextrrrrsV





����zSmartQuotes.applyN)r r!r"r#r$rZFixedTextElement�SpecialrZZimagerIZmath�rawZproblematicrJr]rGrOrrrrrrE�s�rE)r#Z
__docformat__rL�sysrZdocutilsrrZdocutils.transformsrrZdocutils.utilsr�version_info�strrKr	r%r-r8r;r<r=rErrrr�<module>s"

>&