a
    ö£BeÒ  ã                   @   sö   d dl Z ddlmZ g d¢Ze  de d ¡Ze  de d ¡Ze  de d ¡Zd	e d
 Zde d Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd „ Zd!d"„ Zd#d$„ Zd%d&„ Zd'd(„ Zd)d*„ Zd+d,„ Zd-d.„ ZdS )/é    Né   )ÚPREVENT_BACKSLASH)ÚstrikethroughÚmarkÚinsertÚsuperscriptÚ	subscriptz(?:z\\~|[^\s~])~~(?!~)z\\=|[^\s=])==(?!=)z\\\^|[^\s^])\^\^(?!\^)z\^(?:z\\\^|\S|\\ )+?\^z~(?:z\\~|\S|\\ )+?~c                 C   s   t | ||dtƒS )Nr   )Ú_parse_to_endÚ_STRIKE_END©ÚinlineÚmÚstate© r   ú]/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/mistune/plugins/formatting.pyÚparse_strikethrough   s    r   c                 C   s   d| d S )Nz<del>z</del>r   ©ÚrendererÚtextr   r   r   Úrender_strikethrough   s    r   c                 C   s   t | ||dtƒS )Nr   )r	   Ú	_MARK_ENDr   r   r   r   Ú
parse_mark   s    r   c                 C   s   d| d S )Nz<mark>z</mark>r   r   r   r   r   Úrender_mark   s    r   c                 C   s   t | ||dtƒS )Nr   )r	   Ú_INSERT_ENDr   r   r   r   Úparse_insert   s    r   c                 C   s   d| d S )Nz<ins>z</ins>r   r   r   r   r   Úrender_insert"   s    r   c                 C   s   t | ||dƒS )Nr   ©Ú_parse_scriptr   r   r   r   Úparse_superscript&   s    r   c                 C   s   d| d S )Nz<sup>z</sup>r   r   r   r   r   Úrender_superscript*   s    r   c                 C   s   t | ||dƒS )Nr   r   r   r   r   r   Úparse_subscript.   s    r    c                 C   s   d| d S )Nz<sub>z</sub>r   r   r   r   r   Úrender_subscript2   s    r!   c                 C   sd   |  ¡ }| |j|¡}|sd S |  ¡ }|j||d … }| ¡ }	||	_|  |	¡}
| ||
dœ¡ |S )Nr   ©ÚtypeÚchildren)ÚendÚsearchÚsrcÚcopyÚrenderÚappend_token)r   r   r   Útok_typeZend_patternÚposÚm1Úend_posr   Ú	new_stater$   r   r   r   r	   6   s    
r	   c                 C   sJ   |  d¡}| ¡ }|dd…  dd¡|_|  |¡}| ||dœ¡ | ¡ S )Nr   é   éÿÿÿÿz\ ú r"   )Úgroupr(   Úreplacer'   r)   r*   r%   )r   r   r   r+   r   r/   r$   r   r   r   r   D   s    

þr   c                 C   s8   | j jddtdd� | jr4| jjdkr4| j dt¡ dS )aI  A mistune plugin to support strikethrough. Spec defined by
    GitHub flavored Markdown and commonly used by many parsers:

    .. code-block:: text

        ~~This was mistaken text~~

    It will be converted into HTML:

    .. code-block:: html

        <del>This was mistaken text</del>

    :param md: Markdown instance
    r   z~~(?=[^\s~])Úlink©ÚbeforeÚhtmlN)r   Úregisterr   r   ÚNAMEr   ©Úmdr   r   r   r   P   s    ür   c                 C   s8   | j jddtdd� | jr4| jjdkr4| j dt¡ dS )zéA mistune plugin to add ``<mark>`` tag. Spec defined at
    https://facelessuser.github.io/pymdown-extensions/extensions/mark/:

    .. code-block:: text

        ==mark me== ==mark \=\= equal==

    :param md: Markdown instance
    r   z==(?=[^\s=])r5   r6   r8   N)r   r9   r   r   r:   r   r;   r   r   r   r   j   s    
ür   c                 C   s8   | j jddtdd� | jr4| jjdkr4| j dt¡ dS )zÞA mistune plugin to add ``<ins>`` tag. Spec defined at
    https://facelessuser.github.io/pymdown-extensions/extensions/caret/#insert:

    .. code-block:: text

        ^^insert me^^

    :param md: Markdown instance
    r   z\^\^(?=[^\s\^])r5   r6   r8   N)r   r9   r   r   r:   r   r;   r   r   r   r   ~   s    
ür   c                 C   s8   | j jdttdd� | jr4| jjdkr4| j dt¡ dS )zÏA mistune plugin to add ``<sup>`` tag. Spec defined at
    https://pandoc.org/MANUAL.html#superscripts-and-subscripts:

    .. code-block:: text

        2^10^ is 1024.

    :param md: Markdown instance
    r   Ú	linebreakr6   r8   N)r   r9   ÚSUPERSCRIPT_PATTERNr   r   r:   r   r;   r   r   r   r   ’   s    
r   c                 C   s8   | j jdttdd� | jr4| jjdkr4| j dt¡ dS )zÓA mistune plugin to add ``<sub>`` tag. Spec defined at
    https://pandoc.org/MANUAL.html#superscripts-and-subscripts:

    .. code-block:: text

        H~2~O is a liquid.

    :param md: Markdown instance
    r   r=   r6   r8   N)r   r9   ÚSUBSCRIPT_PATTERNr    r   r:   r!   r;   r   r   r   r   ¡   s    
r   )ÚreÚhelpersr   Ú__all__Úcompiler
   r   r   r>   r?   r   r   r   r   r   r   r   r   r    r!   r	   r   r   r   r   r   r   r   r   r   r   Ú<module>   s0   