o
    tf                     @   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      t | ||dtS )Nr   )_parse_to_end_STRIKE_ENDinlinemstate r   c/var/www/html/software/conda/envs/catlas/lib/python3.10/site-packages/mistune/plugins/formatting.pyparse_strikethrough      r   c                 C      d| d S )Nz<del>z</del>r   renderertextr   r   r   render_strikethrough      r   c                 C   r	   )Nr   )r
   	_MARK_ENDr   r   r   r   
parse_mark   r   r   c                 C   r   )Nz<mark>z</mark>r   r   r   r   r   render_mark   r   r   c                 C   r	   )Nr   )r
   _INSERT_ENDr   r   r   r   parse_insert   r   r   c                 C   r   )Nz<ins>z</ins>r   r   r   r   r   render_insert"   r   r   c                 C      t | ||dS )Nr   _parse_scriptr   r   r   r   parse_superscript&      r#   c                 C   r   )Nz<sup>z</sup>r   r   r   r   r   render_superscript*   r   r%   c                 C   r    )Nr   r!   r   r   r   r   parse_subscript.   r$   r&   c                 C   r   )Nz<sub>z</sub>r   r   r   r   r   render_subscript2   r   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/   r0   r+   )r   r   r   r1   r   r5   r*   r   r   r   r"   D   s   

r"   c                 C   @   | j jddtdd | jr| jjdkr| jdt dS dS 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   r;   )zA 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=])r<   r=   r?   N)r   r@   r   r   rA   r   rB   r   r   r   r   j      
r   c                 C   r;   )zA 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\^])r<   r=   r?   N)r   r@   r   r   rA   r   rB   r   r   r   r   ~   rD   r   c                 C   @   | j jdttdd | jr| jjdkr| jdt dS dS dS )zA 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   	linebreakr=   r?   N)r   r@   SUPERSCRIPT_PATTERNr#   r   rA   r%   rB   r   r   r   r         
r   c                 C   rE   )zA 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   rF   r=   r?   N)r   r@   SUBSCRIPT_PATTERNr&   r   rA   r'   rB   r   r   r   r      rH   r   )rehelpersr   __all__compiler   r   r   rG   rI   r   r   r   r   r   r   r#   r%   r&   r'   r
   r"   r   r   r   r   r   r   r   r   r   <module>   s2    