%PDF- %PDF-
Mini Shell

Mini Shell

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

�

'W�d�&���dZddlmZddlmZddlZddlmZmZm	Z	ddl
mZmZddl
mZdd	lmZmZGd
�de	�ZGd�d
e�Zy)z�
class Renderer

Generates HTML from parsed token stream. Each instance has independent
copy of rules. Those can be rewritten with ease. Also, you can add new
rules if you create plugin and adds new token types.
�)�annotations)�SequenceN)�Any�ClassVar�Protocol�)�
escapeHtml�unescapeAll)�Token)�EnvType�OptionsDictc�0�eZdZUded<								dd�Zy)�RendererProtocolz
ClassVar[str]�
__output__c��y�N�)�self�tokens�options�envs    �6/usr/lib/python3/dist-packages/markdown_it/renderer.py�renderzRendererProtocol.renders��	�N)r�Sequence[Token]rr
rr�returnr)�__name__�
__module__�__qualname__�__annotations__rrrrrrs-�����%��0;��BI��	�rrc��eZdZdZdZddd�Z								dd�Z								dd�Z										dd�Ze	dd��Z
								dd	�Z										dd
�Z										dd�Z
										dd�Z										dd
�Z										dd�Z										dd�Z										dd�Z										dd�Z										dd�Zy)�RendererHTMLa�Contains render rules for tokens. Can be updated and extended.

    Example:

    Each rule is called as independent static function with fixed signature:

    ::

        class Renderer:
            def token_type_name(self, tokens, idx, options, env) {
                # ...
                return renderedHTML

    ::

        class CustomRenderer(RendererHTML):
            def strong_open(self, tokens, idx, options, env):
                return '<b>'
            def strong_close(self, tokens, idx, options, env):
                return '</b>'

        md = MarkdownIt(renderer_cls=CustomRenderer)

        result = md.render(...)

    See https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js
    for more details and examples.
    �htmlNc���tj|tj��D��cic]*\}}|jd�s|jd�s||��,c}}|_ycc}}w)N)�	predicater�_)�inspect�
getmembers�ismethod�
startswith�rules)r�parser�k�vs    r�__init__zRendererHTML.__init__<sU�� �*�*�4�7�;K�;K�L�
���1��L�L��*�a�l�l�3�.?�
�q�D�
��
��
s�/A"c�T�d}t|�D]�\}}|jdk(r.|js�"||j|j||�z
}�C|j|jvr&||j|j||||�z
}��||j||||�z
}��|S)z�Takes token stream and generates HTML.

        :param tokens: list on block tokens to render
        :param options: params of parser instance
        :param env: additional data from parsed input

        ��inline)�	enumerate�type�children�renderInliner+�renderToken�rrrr�result�i�tokens       rrzRendererHTML.renderCs�����!�&�)�	D�H�A�u��z�z�X�%��>�>��d�/�/������M�M�F����t�z�z�)��0�$�*�*�U�Z�Z�0���G�S�I�I���$�*�*�6�1�g�s�C�C��	D��
rc���d}t|�D]Z\}}|j|jvr&||j|j||||�z
}�D||j||||�z
}�\|S)aThe same as ``render``, but for single token of `inline` type.

        :param tokens: list on block tokens to render
        :param options: params of parser instance
        :param env: additional data from parsed input (references, for example)
        r1)r3r4r+r7r8s       rr6zRendererHTML.renderInlineZsz����!�&�)�	D�H�A�u��z�z�T�Z�Z�'��0�$�*�*�U�Z�Z�0���G�S�I�I���$�*�*�6�1�g�s�C�C��		D��
rc�P�d}d}||}|jry|jr(|jdk7r|r||dz
jr|dz
}||jdk(rdnd|jzz
}||j	|�z
}|jdk(r
|d	r|d
z
}|jrrd}|jdk(ra|dzt|�krP||dz}|jdk(s|jrd}n*|jdk(r|j|jk(rd}||rd
z
}|Sdz
}|S)z�Default token renderer.

        Can be overridden by custom function

        :param idx: token index to render
        :param options: params of parser instance
        r1F���r�
z</�<r�xhtmlOutz /Tr2z>
�>)�hidden�block�nesting�tag�renderAttrs�lenr4)	rr�idxrrr9�needLfr;�	nextTokens	         rr7zRendererHTML.renderTokenms>�������s����<�<���;�;�5�=�=�B�.�3�6�#��'�?�;Q�;Q��d�N�F�	�5�=�=�B�.�4�C�5�9�9�D�D��	�$�"�"�5�)�)���=�=�A��'�*�"5��d�N�F��;�;��F��}�}��!�s�Q�w��V��'<�"�3��7�O�	��>�>�X�-��1A�1A�#�F��&�&�"�,����%�)�)�1K�#�F��6�%�*���
�(+�*���
rc��d}|j�D]1\}}|dt|�zdztt|��zdzz
}�3|S)z"Render token attributes to string.r1� z="�")�	attrItemsr	�str)r;r9�key�values    rrGzRendererHTML.renderAttrs�sW�����/�/�+�	R�J�C���c�J�s�O�+�d�2�Z��E�
�5K�K�c�Q�Q�F�	R��
rc��d}|xsgD]s}|jdk(r||jz
}�"|jdk(r.|js�>||j|j||�z
}�_|jdk(s�o|dz
}�u|S)aiSpecial kludge for image `alt` attributes to conform CommonMark spec.

        Don't try to use it! Spec requires to show `alt` content with stripped markup,
        instead of simple escaping.

        :param tokens: list on block tokens to render
        :param options: params of parser instance
        :param env: additional data from parsed input
        r1�text�image�	softbreakr?)r4�contentr5�renderInlineAsText)rrrrr9r;s      rrXzRendererHTML.renderInlineAsText�s������\�r�	�E��z�z�V�#��%�-�-�'�����w�&��>�>��d�5�5�e�n�n�g�s�S�S�F����{�*��$���	��
rc�r�||}d|j|�zdzt||j�zdzS)Nz<coderBz</code>�rGr	rW�rrrIrrr;s      r�code_inlinezRendererHTML.code_inline�sS���s�������u�%�
&��
�����,�,�-�
.��	
�	
rc�r�||}d|j|�zdzt||j�zdzS)N�<prez><code>�</code></pre>
rZr[s      r�
code_blockzRendererHTML.code_block�sU���s���
����u�%�
&��
�����,�,�-�
.� �	
 �	
rc��||}|jr#t|j�j�nd}d}d}|r*|jd��}	|	d}t	|	�dk(r|	d}|j
r5|j|j||�xst|j�}
nt|j�}
|
jd�r|
dzS|rctddd|jj���}|jd	|j|z�d
|j|�zdz|
zdzSd
|j|�zdz|
zdzS)
Nr1r)�maxsplitr�r^r?)r4rFrE�attrs�classz
<pre><coderBr_)�infor
�strip�splitrH�	highlightrWr	r*rrd�copy�attrJoin�
langPrefixrG)rrrIrrr;rf�langName�	langAttrs�arr�highlighted�tmpTokens            r�fencezRendererHTML.fence�sv���s���27�*�*�{�5�:�:�&�,�,�.�"�����	���*�*�a�*�(�C��1�v�H��3�x�1�}���F�	����!�+�+��
�
�x���+��E�M�M�*�
�%�U�]�]�3�K��!�!�&�)���%�%�
��"�"�a�u�{�{�?O�?O�?Q�R�H����g�w�'9�'9�H�'D�E���"�"�8�,�-�����$�	$�
�
����u�%�
&��
��
� �	
 �	
rc���||}|jr.|jd|j|j||��n|jdd�|j||||�S)N�altr1)r5�attrSetrXr7r[s      rrUzRendererHTML.image%s]���s����>�>��M�M�%��!8�!8�����RU�!V�W��M�M�%��$������W�c�:�:rc�"�|jrdSdS)N�<br />
�<br>
)rA�rrrIrrs     r�	hardbreakzRendererHTML.hardbreak7s��%�-�-�z�;�8�;rc�>�|jr|jrdSdSdS)Nrwrxr?)�breaksrArys     rrVzRendererHTML.softbreak<s+��?F�n�n�7�+�+�Z�	
�19�	
�RV�	
rc�2�t||j�Sr)r	rWrys     rrTzRendererHTML.textCs���&��+�-�-�.�.rc� �||jSr�rWrys     r�
html_blockzRendererHTML.html_blockH����c�{�"�"�"rc� �||jSrrrys     r�html_inlinezRendererHTML.html_inlineMr�rr)r,r)rrrr
rrrrP)
rrrI�intrr
rrrrP)r;rrrP)rzSequence[Token] | Nonerr
rrrrP)rrr�__doc__rr/rr6r7�staticmethodrGrXr\r`rrrUrzrVrTr�r�rrrr"r"s����:�J�
��%��0;��BI��	��.�%��0;��BI��	��&=��=��=��	=�
�=�

�
=�~�����&�����	�


��<

�%�

�,/�

�:E�

�LS�

�	�

�
��
��
��	
�
�
�

�

�"2
��2
��2
��	2
�
�2
�

�
2
�h;��;��;��	;�
�;�

�
;�$<�%�<�,/�<�:E�<�LS�<�	�<�

�%�
�,/�
�:E�
�LS�
�	�
�/�%�/�,/�/�:E�/�LS�/�	�/�
#�%�#�,/�#�:E�#�LS�#�	�#�
#�%�#�,/�#�:E�#�LS�#�	�#rr")r��
__future__r�collections.abcrr'�typingrrr�common.utilsr	r
r;r�utilsrr
rr"rrr�<module>r�s?���#�$��*�*�1��'��x��t#�#�t#r

Zerion Mini Shell 1.0