%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/markdown/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/markdown/__pycache__/serializers.cpython-312.pyc

�

���e����dZddlmZddlmZddlmZmZmZmZm	Z	ddl
Z
ddlmZm
Z
mZddgZe
j d	e
j"�Zdd
�Zdd�Zdd�Zdd
�Zdd�Zddd�Zdd�Zdd�Zy)a�
Python-Markdown provides two serializers which render [`ElementTree.Element`][xml.etree.ElementTree.Element]
objects to a string of HTML. Both functions wrap the same underlying code with only a few minor
differences as outlined below:

1. Empty (self-closing) tags are rendered as `<tag>` for HTML and as `<tag />` for XHTML.
2. Boolean attributes are rendered as `attrname` for HTML and as `attrname="attrname"` for XHTML.
�)�annotations)�ProcessingInstruction)�Comment�ElementTree�Element�QName�
HTML_EMPTYN)�Callable�Literal�NoReturn�to_html_string�to_xhtml_stringz)&(?!(?:\#[0-9]+|\#x[0-9a-f]+|[0-9a-z]+);)c�^�tdj|t|�j���)Nzcannot serialize {!r} (type {}))�	TypeError�format�type�__name__��texts �6/usr/lib/python3/dist-packages/markdown/serializers.py�_raise_serialization_errorr:s)��
�)�0�0��t�D�z�7J�7J�K�
�
�c���	d|vrtjd|�}d|vr|jdd�}d|vr|jdd�}|S#ttf$rt|�YywxYw)N�&�&amp;�<�&lt;�>�&gt;��RE_AMP�sub�replacer�AttributeErrorrrs r�
_escape_cdatar%@so��
)��$�;��:�:�g�t�,�D��$�;��<�<��V�,�D��$�;��<�<��V�,�D�����~�&�)�"�4�(�)�s�AA
�
A'�&A'c�,�	d|vrtjd|�}d|vr|jdd�}d|vr|jdd�}d|vr|jdd�}d	|vr|jd	d
�}|S#ttf$rt|�YywxYw)Nrrrrrr�"�&quot;�
z&#10;r rs r�_escape_attribr*Rs���)��$�;��:�:�g�t�,�D��$�;��<�<��V�,�D��$�;��<�<��V�,�D��4�<��<�<��h�/�D��4�<��<�<��g�.�D�����~�&�)�"�4�(�)�s�A3A6�6B�Bc��	d|vrtjd|�}d|vr|jdd�}d|vr|jdd�}d|vr|jdd�}|S#ttf$rt|�YywxYw)	Nrrrrrrr'r(r rs r�_escape_attrib_htmlr,es���)��$�;��:�:�g�t�,�D��$�;��<�<��V�,�D��$�;��<�<��V�,�D��4�<��<�<��h�/�D�����~�&�)�"�4�(�)�s�AA � A=�<A=c��|j}|j}|tur|dt|�z��n�|tur|dt|�z��n�|�)|r|t|��|D]}t|||���n�d}t
|t�r@|jdddk(r#|jddjdd�\}}ntd��|d|z�|j�}|r�t|�}|D]w\}}	t
|t�r|j}t
|	t�r
|	j}	nt|	�}	||	k(r|dk(r|d	|	z��`|d
j||	���y|r|dt|�z�|dk(r|j�t vr	|d
�nn|d�|r,|j�dvr	||�n|t|��|D]}t|||��|j�t vr|d|zdz�|j"r|t|j"��yy)Nz	<!--%s-->z<?%s?>��{�}z QName objects must define a tag.r�htmlz %sz {}="{}"z xmlns="%s"�xhtmlz />r)�script�stylez</)�tagrrr%r�_serialize_html�
isinstancer�split�
ValueError�items�sortedr,rr*�lowerr	�tail)
�write�elemrr5r�e�
namespace_urir:�k�vs
          rr6r6vs��
�(�(�C��9�9�D�
�g�~�
�k�M�$�/�/�0�	�%�	%�
�h��t�,�,�-�	����-��%�&��	.�A��E�1�f�-�	.��
��c�5�!��x�x���|�s�"�%(�X�X�a�b�\�%7�%7��Q�%?�"�
�s� �!C�D�D�
�c�C�i���
�
�����5�M�E��

3���1��a��'����A��a��'����A�+�A�.�A���6�f��.��%�!�)�$��*�+�+�A�q�1�2�

3���-�>�-�#@�A�B��W������
�!:��%�L��#�J���9�9�;�"5�5��$�K��-��-�.��
2����q�&�1�
2��y�y�{�*�,��d�S�j�3�&�'��y�y�
�m�D�I�I�&�'�rc�b�|�J�g}|j}t|||�dj|�S)N�)�appendr6�join)�rootr�datar>s    r�_write_htmlrJ�s6�������D��K�K�E��E�4��(�
�7�7�4�=�rc�J�tt|�j�d��S)z: Serialize element and its children to a string of HTML5. r1�r�rJr�getroot��elements rr
r
�s���{�7�+�3�3�5�f�E�Erc�J�tt|�j�d��S)z: Serialize element and its children to a string of XHTML. r2rLrMrOs rrr�s���{�7�+�3�3�5�g�F�Fr)r�str�returnr)rSrR)rrRrSrR)r>zCallable[[str], None]r?rr�Literal['html', 'xhtml']rS�None)r1)rHrrrTrSrR)rPrrSrR)�__doc__�
__future__r�xml.etree.ElementTreerrrrrr	�re�typingr
rr�__all__�compile�Ir!rr%r*r,r6rJr
r�rr�<module>r_so��J�#�7�R�R�	�.�.��.�
/��	����@�"�$�$�	G��
�)�$)�&)�"6(�r�F�
Gr

Zerion Mini Shell 1.0