
    Mh                         d dl Z d dlZd dlmZmZ ddlmZ ddlmZ erddl	m
Z
 ddlmZmZmZ ddlmZ dd	lmZ d
gZdez   dz   Zdddee         dddefdZdddeddddfdZdddededefdZd dZdS )!    N)TYPE_CHECKINGMatch   )PREVENT_BACKSLASHescape)BlockParser)BaseRenderer
BlockStateInlineState)InlineParser)Markdownabbrz^ {0,3}\*\[(?P<abbr_key>[^\]]+)z<\]:(?P<abbr_text>(?:[ \t]*\n(?: {3,}|\t)[^\n]+)|(?:[^\n]*))$blockr	   mstater   returnc                 0   |j                             d          }|si }|                    d          }|                    d          }|                                ||<   ||j         d<   |                    ddi           |                                dz   S )N	ref_abbrsabbr_key	abbr_texttype
blank_line   )envgetgroupstripappend_tokenend)r   r   r   refkeytexts         T/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mistune/plugins/abbr.pyparse_ref_abbrr%      s    
)--
$
$C 
''*

C77;Dzz||CH EIk	-...5577Q;    inliner   r#   r   c                    |j                             d          }|s|                    d|d          S |j        r=|j        d         }|d         dk    r$|j                                         |d         |z   }|j                             d          }|sMt          j        d                    d	 |                                D                                 }||j         d<   d
}|t          |          k     r|
                    ||          }|sn|                                }||k    r"|||         }	|                    d|	d           |                    d
          }
|                    dd|
dgd||
         id           |                                }|t          |          k     |d
k    r|                    d|d           d S |t          |          k     r"|                    d||d          d           d S d S )Nr   r#   )r   rawr   r)   abbrs_re|c              3   >   K   | ]}t          j        |          V  d S )N)rer   ).0ks     r$   	<genexpr>zprocess_text.<locals>.<genexpr>1   s*      'I'I	!'I'I'I'I'I'Ir&   r   r   title)r   childrenattrs)r   r   r   tokenspopr.   compilejoinkeyslensearchstartr   r    )r'   r#   r   r!   lastr+   posr   end_posholelabels              r$   process_textrB   $   s%   
)--
$
$C A!!6$"?"?@@@| &|B<6!!L;%Dy}}Z((H ):dii'I'Ichhjj'I'I'IIIJJ (	*
C
D		//OOD#&& 	''))S==G$Dt<<===

6%*H*H)IU\^abg^hTijj	
 	
 	
 eegg D		//  axxF48899999	s4yyF4:>>????? 
r&   rendererr
   r2   c                 L    |sd|z   dz   S dt          |          z   dz   |z   dz   S )Nz<abbr>z</abbr>z<abbr title="z">r   )rC   r#   r2   s      r$   render_abbrrE   L   s9     +$**VE]]*T1D89DDr&   mdr   c                    | j                             dt          t          d           t	          j        t          | j                  | j        _        | j        r2| j        j	        dk    r$| j                            dt                     dS dS dS )aG  A mistune plugin to support abbreviations, spec defined at
    https://michelf.ca/projects/php-markdown/extra/#abbr

    Here is an example:

    .. code-block:: text

        The HTML specification
        is maintained by the W3C.

        *[HTML]: Hyper Text Markup Language
        *[W3C]:  World Wide Web Consortium

    It will be converted into HTML:

    .. code-block:: html

        The <abbr title="Hyper Text Markup Language">HTML</abbr> specification
        is maintained by the <abbr title="World Wide Web Consortium">W3C</abbr>.

    :param md: Markdown instance
    ref_abbr	paragraph)beforehtmlr   N)r   registerREF_ABBRr%   types
MethodTyperB   r'   rC   NAMErE   )rF   s    r$   r   r   R   s    . Hj(N;OOO"-lBIFFBI	{ 2r{'611
V[111112 211r&   )rF   r   r   N)r.   rN   typingr   r   helpersr   utilr   block_parserr	   corer
   r   r   inline_parserr   markdownr   __all__rM   strintr%   rB   rE   r    r&   r$   <module>r\      s   				  ' ' ' ' ' ' ' ' ' ' ' ' ' '       $******<<<<<<<<<<,,,,,,######( '):: >A A 	
- 
E#J 
| 
PS 
 
 
 
%@ %@s %@= %@T %@ %@ %@ %@PE. E EC EC E E E E2 2 2 2 2 2r&   