%PDF- %PDF-
Mini Shell

Mini Shell

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

�

���e�7���dZddlmZddlZddlZddlZddlmZm	Z	erddl
mZejjd�Zejje�Zej"j%e�eej&d<ej(d�e_ej(d	�e_ej,e_ej(d
ej0�e_ej(d�ZGd�d
ej6�Zy)a
This module imports a copy of [`html.parser.HTMLParser`][] and modifies it heavily through monkey-patches.
A copy is imported rather than the module being directly imported as this ensures that the user can import
and  use the unmodified library for their own needs.
�)�annotationsN)�
TYPE_CHECKING�Sequence)�Markdownzhtml.parser�
htmlparserz\?>z&([a-zA-Z][-.a-zA-Z0-9]*);a�
  <[a-zA-Z][^`\t\n\r\f />\x00]*       # tag name <= added backtick here
  (?:[\s/]*                           # optional whitespace before attribute name
    (?:(?<=['"\s/])[^`\s/>][^\s/=>]*  # attribute name <= added backtick here
      (?:\s*=+\s*                     # value indicator
        (?:'[^']*'                    # LITA-enclosed value
          |"[^"]*"                    # LIT-enclosed value
          |(?!['"])[^`>\s]*           # bare value <= added backtick here
         )
         (?:\s*,)*                    # possibly followed by a comma
       )?(?:\s|/(?!>))*
     )*
   )?
  \s*                                 # trailing whitespace
z^([ ]*\n){2}c���eZdZUdZd�fd�Z�fd�Z�fd�Zedd��Zdd�Z	dd�Z
dd�Zd d	�Zd!d
�Z
d"d�Zd d�Zd#d
�Zd#d�Zd!d�Zd!d�Zd!d�Zd!d�Zd$�fd�Zd$�fd�Zd%d&�fd�
ZdZded<d'd�Zd$d�Z�xZS)(�
HTMLExtractorz�
    Extract raw HTML from text.

    The raw HTML is stored in the [`htmlStash`][markdown.util.HtmlStash] of the
    [`Markdown`][markdown.Markdown] instance passed to `md` and the remaining text
    is stored in `cleandoc` as a list of strings.
    c�v��d|vrd|d<tdg�|_dg|_t�|�|i|��||_y)N�convert_charrefsF�hrr)�set�
empty_tags�lineno_start_cache�super�__init__�md)�selfr�args�kwargs�	__class__s    ��5/usr/lib/python3/dist-packages/markdown/htmlparser.pyrzHTMLExtractor.__init__SsJ����V�+�).�F�%�&��t�f�+���#$�#���	���$�)�&�)����c�x��d|_d|_g|_g|_g|_dg|_t�|��y)z1Reset this instance.  Loses all unprocessed data.FrN)�inraw�intail�stack�_cache�cleandocrr�reset�rrs �rrzHTMLExtractor.reset`s9�����
���� "��
�!#���#%��
�#$�#���
��
�rc���t�|��t|j�rb|jr;|j
s/|j
tj|j��n|j
|j�t|j�r_|jj|jjjdj|j���g|_	yy)zHandle any buffered data.�N)r�close�len�rawdatar�
cdata_elem�handle_datar�unescaperr�appendr�	htmlStash�store�joinr s �rr#zHTMLExtractor.closeks����
��
���t�|�|���$�$�T�_�_�� � ��!4�!4�T�\�\�!B�C�� � ����.��t�{�{���M�M� � ����!2�!2�!8�!8�������9M�!N�O��D�K�rc�h�tt|j�dz
|jdz
�D]e}|j|}|jjd|�}|dk(rt|j�}|jj
|dz��g|j|jdz
S)zHReturns char index in `self.rawdata` for the start of the current line. ��
���)�ranger$r�linenor%�findr))r�ii�last_line_start_pos�lf_poss    r�line_offsetzHTMLExtractor.line_offsetzs�����D�3�3�4�Q�6����A�
�F�	5�B�"&�"9�"9�"�"=���\�\�&�&�t�-@�A�F���|��T�\�\�*���#�#�*�*�6�!�8�4�
	5��&�&�t�{�{�1�}�5�5rc���|jdk(ry|jdkDry|j|j|j|jzj�dk(S)z�
        Returns True if current position is at start of line.

        Allows for up to three blank spaces at start of line.
        rT�Fr")�offsetr%r7�strip�rs r�
at_line_startzHTMLExtractor.at_line_start�sV���;�;�!����;�;��?���|�|�D�,�,�T�-=�-=����-K�L�R�R�T�XZ�Z�Zrc���|j|jz}tjj	|j
|�}|r|j
||j
�Sdj|�S)z�
        Returns the text of the end tag.

        If it fails to extract the actual text from the raw data, it builds a closing tag with `tag`.
        z</{}>)r7r:r�	endendtag�searchr%�end�format)r�tag�start�ms    r�get_endtag_textzHTMLExtractor.get_endtag_text�s_��� � �4�;�;�.��� � �'�'����e�<����<�<��a�e�e�g�.�.��>�>�#�&�&rc�*�||jvr|j||�y|jj|�rJ|js|j�r.|js"d|_|jjd�|j�}|jr7|jj|�|jj|�y|jj|�||jvr|j�yy)NTr/)r�handle_startendtagr�is_block_levelrr=rrr)�get_starttag_textrr�CDATA_CONTENT_ELEMENTS�clear_cdata_mode)rrC�attrs�texts    r�handle_starttagzHTMLExtractor.handle_starttag�s����$�/�/�!��#�#�C��/���7�7�!�!�#�&�D�K�K�D�<N�<N�<P�Y]�Yc�Yc��D�J��M�M� � ��&��%�%�'���:�:��J�J���c�"��K�K���t�$��M�M� � ��&��d�1�1�1��%�%�'�2rc�:�|j|�}|j�rb|jj|�||jvr7|jr+|jj�|k(rn
|jr�+t
|j�dk(r�tj|j|j|jzt
|�zd�r|jjd�nd|_d|_|jj|jjj!dj#|j���|jjd�g|_yy|jj|�y)Nrr/TFr"�

)rFrrr)r�popr$�
blank_line_re�matchr%r7r:rrrr*r+r,)rrCrNs   r�
handle_endtagzHTMLExtractor.handle_endtag�s,���#�#�C�(���:�:��K�K���t�$��d�j�j� ��j�j��z�z�~�~�'�3�.���j�j��4�:�:��!�#� �&�&�t�|�|�D�4D�4D�t�{�{�4R�UX�Y]�U^�4^�4_�'`�a��K�K�&�&�t�,�#'�D�K�"��
��
�
�$�$�T�W�W�%6�%6�%<�%<�R�W�W�T�[�[�=Q�%R�S��
�
�$�$�V�,� ���$�
�M�M� � ��&rc��|jrd|vrd|_|jr|jj|�y|jj|�y)Nr/F)rrrr)r�r�datas  rr'zHTMLExtractor.handle_data�sA���;�;�4�4�<��D�K��:�:��K�K���t�$��M�M� � ��&rc���|js|jr|jj|�y|j	��r	|�rt
j
|j|j|jzt|�zd�r|dz
}nd|_|jr|jdnd}|jd�s,|jd�r|jjd�|jj|jjj|��|jjd�y|jj|�y)z Handle empty tags (`<data>`). Nr/Tr0r"rQ)rrrr)r=rSrTr%r7r:r$r�endswithrr*r+)rrX�is_block�items    r�handle_empty_tagzHTMLExtractor.handle_empty_tag�s���:�:�����K�K���t�$�
�
�
�
!�h��"�"�4�<�<��0@�0@�4�;�;�0N�QT�UY�QZ�0Z�0[�#\�]�����#���(,�
�
�4�=�=��$�2�D��=�=��(�T�]�]�4�-@��
�
�$�$�T�*��M�M� � ����!2�!2�!8�!8��!>�?��M�M� � ��(��M�M� � ��&rc�x�|j|j�|jj|���y)N�r[)r]rJrrI)rrCrMs   rrHz HTMLExtractor.handle_startendtag�s.�����d�4�4�6����AW�AW�X[�A\��]rc�H�|jdj|�d��y)Nz&#{};Fr_�r]rB�r�names  r�handle_charrefzHTMLExtractor.handle_charref�s�����g�n�n�T�2�U��Crc�H�|jdj|�d��y)Nz&{};Fr_rarbs  r�handle_entityrefzHTMLExtractor.handle_entityref�s�����f�m�m�D�1�E��Brc�H�|jdj|�d��y)Nz	<!--{}-->Tr_rarWs  r�handle_commentzHTMLExtractor.handle_comment�s �����k�0�0��6���Frc�H�|jdj|�d��y)Nz<!{}>Tr_rarWs  r�handle_declzHTMLExtractor.handle_decl�s�����g�n�n�T�2�T��Brc�H�|jdj|�d��y)Nz<?{}?>Tr_rarWs  r�	handle_pizHTMLExtractor.handle_pis�����h�o�o�d�3�d��Crc�t�|jd�rdnd}|jdj||�d��y)NzCDATA[z]]>z]>z<![{}{}Tr_)�
startswithr]rB)rrXrAs   r�unknown_declzHTMLExtractor.unknown_decls4�����x�0�e�d�����i�.�.�t�S�9�D��Irc���|j�s|jrt�|�
|�S|j	d�|dzS)Nz<?�)r=rr�parse_pir'�r�irs  �rrrzHTMLExtractor.parse_pis>�������4�;�;��7�#�A�&�&�	
������1�u�rc���|j�s|jrt�|�
|�S|j	d�|dzS)Nz<!rq)r=rr�parse_html_declarationr'rss  �rrvz$HTMLExtractor.parse_html_declarations>�������4�;�;��7�1�!�4�4�	
������1�u�rc�t��t�|�||�}|dk(ry|j|j||d��|S)Nr0Fr_)r�parse_bogus_commentr]r%)rrt�report�posrs    �rrxz!HTMLExtractor.parse_bogus_commentsC����g�)�!�V�4���"�9�����d�l�l�1�S�1�E��B��
rNz
str | None�_HTMLExtractor__starttag_textc��|jS)z)Return full source of start tag: `<...>`.)r{r<s rrJzHTMLExtractor.get_starttag_text's���#�#�#rc���d|_|j|�}|dkr|S|j}||||_g}tjj||dz�}|sJd��|j
�}|jd�j�x|_	}||kr�tjj||�}|sn�|jddd�\}	}
}|
sd}n,|dddcxk(r|ddk(sn|dddcxk(r|ddk(rnn|dd}|rtj|�}|j|	j�|f�|j
�}||kr��|||j�}|d	vr�|j�\}
}d
|jvrP|
|jjd
�z}
t!|j�|jj#d
�z
}n|t!|j�z}|j%|||�|S|j'd�r|j)||�|S||j*vr|j-|�|j/||�|S)Nrr.z#unexpected call to parse_starttag()rqr9�'r0�")�>�/>r/r�)r{�check_for_whole_start_tagr%r�tagfind_tolerantrTrA�group�lower�lasttag�attrfind_tolerantr(r)r;�getpos�countr$�rfindr'rZrHrK�set_cdata_moderO)rrt�endposr%rMrT�krCrE�attrname�rest�	attrvaluerAr2r:s               r�parse_starttagzHTMLExtractor.parse_starttag+s`��#����/�/��2���A�:��M��,�,��&�q��0������+�+�1�1�'�1�Q�3�?���;�;�;�u��I�I�K��"�[�[��^�1�1�3�3���s��&�j��,�,�2�2�7�A�>�A���()����1�a�(8�%�H�d�I�� �	��2�A��$�8�)�B�C�.�8��2�A��#�7��2�3��7�%�a��O�	��&�/�/�	�:�	��L�L�(�.�.�*�I�6�7�����A��&�j��a���%�%�'���k�!�!�[�[�]�N�F�F��t�+�+�+��$�"6�"6�"<�"<�T�"B�B���T�1�1�2��/�/�5�5�d�;�<�� �#�d�&:�&:�";�;�����W�Q�v�.�/��M��<�<����#�#�C��/��
��d�1�1�1��#�#�C�(�� � ��e�,��
r)rr)�return�int)r��bool)rC�strr�r�)rCr�rMzSequence[tuple[str, str]])rCr�)rXr�)rXr�r[r�)rcr�)rtr�r�r�)r)rtr�ryr�r�r�)r�r�)�__name__�
__module__�__qualname__�__doc__rrr#�propertyr7r=rFrOrUr'r]rHrdrfrhrjrlrorrrvrxr{�__annotations__rJr��
__classcell__)rs@rr	r	Js������	�
��
6��
6�[�
'�(�*'�6'�'�.^�D�C�G�C�D�J����#'�O�Z�&�$�0rr	)r��
__future__r�re�importlib.util�	importlib�sys�typingrr�markdownr�util�	find_spec�spec�module_from_specr�loader�exec_module�modules�compile�piclose�	entityref�
incomplete�VERBOSE�locatestarttagend_tolerantrS�
HTMLParserr	�rr�<module>r�s���(�#�	��
�*��!�
�~�~���
�.��
�^�^�
,�
,�T�
2�
������
�#�&����L�� �R�Z�Z��'�
��!�r�z�z�"?�@�
��#�,�,�
��(2��
�
�4��Z�Z�)�
�%�$��
�
�?�+�
�Q�J�)�)�Qr

Zerion Mini Shell 1.0