
    f                     >    g d Z dZdZd Zd Zd Zd Zd Zd Zd	 Z	y
))mathmath_in_quotemath_in_listz7^ {0,3}\$\$[ \t]*\n(?P<math_text>[\s\S]+?)\n\$\$[ \t]*$z"\$(?!\s)(?P<math_text>.+?)(?!\s)\$c                 r    |j                  d      }|j                  d|d       |j                         dz   S )N	math_text
block_mathtyperaw   groupappend_tokenend)blockmstatetexts       O/var/www/cvtools/html/venv/lib/python3.12/site-packages/mistune/plugins/math.pyparse_block_mathr      s3    77;D	T:;557Q;    c                 l    |j                  d      }|j                  d|d       |j                         S )Nr   inline_mathr   r   )inliner   r   r   s       r   parse_inline_mathr      s.    77;D	d;<557Nr   c                     d|z   dz   S )Nz<div class="math">$$
z

$$</div>
 rendererr   s     r   render_block_mathr      s    #d*^;;r   c                     d|z   dz   S )Nz<span class="math">\(z	\)</span>r   r   s     r   render_inline_mathr!      s    #d*\99r   c                 n   | j                   j                  dt        t        d       | j                  j                  dt
        t        d       | j                  r[| j                  j                  dk(  rA| j                  j                  dt               | j                  j                  dt               yyy)a'  A mistune plugin to support math. The syntax is used
    by many markdown extensions:

    .. code-block:: text

        Block math is surrounded by $$:

        $$
        f(a)=f(b)
        $$

        Inline math is surrounded by `$`, such as $f(a)=f(b)$

    :param md: Markdown instance
    r   listbeforer   linkhtmlN)r   registerBLOCK_MATH_PATTERNr   r   INLINE_MATH_PATTERNr   r   NAMEr   r!   mds    r   r   r      s      HHl$68HQWXII}&9;LU[\	{{r{{''61
\+<=
],>? 2{r   c                 h    | j                   j                  | j                   j                  dd       y)z(Enable block math plugin in block quote.r   r#   r$   N)r   insert_ruleblock_quote_rulesr,   s    r   r   r   2   s%    HH33\&Qr   c                 h    | j                   j                  | j                   j                  dd       y)z!Enable block math plugin in list.r   r#   r$   N)r   r/   
list_rulesr,   s    r   r   r   7   s%    HH,,l6Jr   N)
__all__r)   r*   r   r   r   r!   r   r   r   r   r   r   <module>r4      s<   
3O ; <:@.R
Kr   