
    F\h                     :   S r SSKrSSKJr  SS/rSNS jr0 SS_SS	_S
S_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_S S!_S"S#_S$S%_S&S'_0 S(S)_S*S+_S,S-_S.S/_S0S1_S2S3_S4S5_S6S7_S8S9_S:S;_S<S=_S>S?_S@SA_SBSC_SDSE_SFSG_SHSI_Er1 SJkr	SK r
\R                  " SL5      rSM rg)Oz*
General functions for HTML manipulation.
    N)html5escapeunescapec                     U R                  SS5      n U R                  SS5      n U R                  SS5      n U(       a$  U R                  SS5      n U R                  S	S
5      n U $ )z
Replace special characters "&", "<" and ">" to HTML-safe sequences.
If the optional flag quote is true (the default), the quotation mark
characters, both double quote (") and single quote (') characters are also
translated.
&z&amp;<z&lt;>z&gt;"z&quot;'z&#x27;)replace)squotes     $/usr/lib/python3.13/html/__init__.pyr   r      s\     	
		#wA			#vA			#vAIIc8$IIdH%H       �      u   €         u   ‚   u   ƒ   u   „   u   …   u   †   u   ‡   u   ˆ   u   ‰   u   Š   u   ‹   u   Œ         u   Ž               u   ‘   u   ’   u   “   u   ”   u   •   u   –   u   —   u   ˜   u   ™   u   š   u   ›   u   œ         u   ž   u   Ÿ>~                                                                                       r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r$   r%   r'   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r7   r8                                                                             	 
                 	 
       c                    U R                  S5      n U S   S:X  a  U S   S;   a  [        U SS  R                  S5      S5      nO[        U SS  R                  S5      5      nU[        ;   a	  [        U   $ SUs=::  a  S	::  d  O  US
:  a  gU[        ;   a  g[        U5      $ U [        ;   a	  [        U    $ [        [        U 5      S-
  SS5       H#  nU S U [        ;   d  M  [        U S U    XS  -   s  $    SU -   $ )Nr9   r   #xXr:   ;rD   i   i  r   r    r   )	groupintrstrip_invalid_charrefs_invalid_codepointschr_html5rangelen)r   numxs      r   _replace_charrefr   [   s    	
Ats{Q44<aell3',Caell3'(C##$S))S"F"cHn%%3x ;!9s1vaxB'A!uae}qu,, ( 7Nr   z7&(#[0-9]+;?|#[xX][0-9a-fA-F]+;?|[^\t\n\f <&#;]{1,32};?)c                 F    SU ;  a  U $ [         R                  [        U 5      $ )aF  
Convert all named and numeric character references (e.g. &gt;, &#62;,
&x3e;) in the string s to the corresponding unicode characters.
This function uses the rules defined by the HTML 5 standard
for both valid and invalid character references, and the list of
HTML 5 named character references defined in html.entities.html5.
r   )_charrefsubr   )r   s    r   r   r   z   s"     !|<<(!,,r   )T)__doc__re_rehtml.entitiesr   r   __all__r   r   r   r   compiler   r    r   r   <module>r      s    ) Z
 $#(#$# 	(# 	&	#
 	(# 	(# 	(# 	(# 	(# 	(# 	(# 	(# 	(# 	(# 	(#  	&!#" 	(##$ 	&%#& 	&'#( 	()#* 	(+#, 	(-#. 	(/#0 	(1#2 	(3#4 	(5#6 	(7#8 	(9#: 	(;#< 	(=#> 	(?#@ 	&A#B 	(C#D 	(E# J 06 ;; 3 4
-r   