
    fV                     Z    d dl Z d dlZddlmZ ddlmZ dgZdez   dz   Zd Zd	 Z	d
 Z
d Zy)    N   escape)PREVENT_BACKSLASHabbrz^ {0,3}\*\[(?P<abbr_key>[^\]]+)z<\]:(?P<abbr_text>(?:[ \t]*\n(?: {3,}|\t)[^\n]+)|(?:[^\n]*))$c                    |j                   j                  d      }|si }|j                  d      }|j                  d      }|j                         ||<   ||j                   d<   |j	                  ddi       |j                         dz   S )N	ref_abbrsabbr_key	abbr_texttype
blank_line   )envgetgroupstripappend_tokenend)blockmstaterefkeytexts         O/var/www/cvtools/html/venv/lib/python3.12/site-packages/mistune/plugins/abbr.pyparse_ref_abbrr      sx    
))--
$C
''*
C77;Dzz|CH EIIk	-.557Q;    c                 |   |j                   j                  d      }|s|j                  d|d      S |j                  r9|j                  d   }|d   dk(  r"|j                  j	                          |d   |z   }|j                   j                  d      }|sHt        j                  dj                  d	 |j                         D                    }||j                   d<   d
}|t        |      k  r|j                  ||      }|sn||j                         }||kD  r||| }	|j                  d|	d       |j                  d
      }
|j                  dd|
dgd||
   id       |j                         }|t        |      k  r|d
k(  r|j                  d|d       y |t        |      k  r|j                  d||d  d       y y )Nr	   r   )r   rawr   r   abbrs_re|c              3   F   K   | ]  }t        j                  |        y w)N)rer   ).0ks     r   	<genexpr>zprocess_text.<locals>.<genexpr>)   s     'I		!'Is   !r   r   title)r   childrenattrs)r   r   r   tokenspopr$   compilejoinkeyslensearchstartr   r   )inliner   r   r   lastr!   posr   end_posholelabels              r   process_textr9      s   
))--
$C!!6$"?@@||||B<6!LL;%Dyy}}Z(H::dii'Ichhj'IIJ (		*
C
D	/OOD#&'')S=G$Dt<=
"(78s5z*
 	
 eeg! D	/$ axF489	s4yF4:>? 
r   c                 D    |sd|z   dz   S dt        |      z   dz   |z   dz   S )Nz<abbr>z</abbr>z<abbr title="z">r   )rendererr   r(   s      r   render_abbrr<   F   s2    $**VE]*T1D89DDr   c                 F   | j                   j                  dt        t        d       t	        j
                  t        | j                        | j                  _        | j                  r;| j                  j                  dk(  r!| j                  j                  dt               yyy)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
MethodTyper9   r3   r;   NAMEr<   )mds    r   r   r   L   so    . HHj(N;O"--lBIIFBII	{{r{{''61
V[1 2{r   )r$   rD   utilr   helpersr   __all__rC   r   r9   r<   r    r   r   <module>rL      sI    	   '( %&77 ;? ? 	
'@TE2r   