ó
    ‰*£h  ã                   ón   • S SK JrJrJr  S SKr\R
                  " \5      rSSKJ	r	J
r
Jr   " S S\5      rg)é    )Úprint_functionÚabsolute_importÚunicode_literalsNé   )ÚRULE_CALLABLEÚUnicodeToLatexConversionRuleÚUnicodeToLatexEncoderc                   ó8   ^ • \ rS rSrSr SU 4S jjrS rSrU =r$ )ÚPartialLatexToLatexEncoderé.   a	  
Encode a string while preserving some (fuzzily detected) LaTeX constructs
that the input string already has (e.g. accent macros or inline math modes).

Sometimes you need to fully LaTeX-encode a string that already has some
LaTeX constructs.  For instance, titles of bibliographic entries might
include some inline math or accents, but they might also include unicode
characters that need to be encoded.  Using a
:py:class:`UnicodeToLatexEncoder` on such strings would result in ugly
doubly-escaped strings such as ``\textbackslash{}'\{e\}``.  Instead,
constructs such as ``\'{e}`` should be preserved while other characters
and/or constructs (say '&' or '%') as well as unicode characters should be
encoded.

This class offers a simple partial solution: Characters are encoded as per
the given `conversion_rules` (or the default conversion rules of
:py:class:`UnicodeToLatexEncoder` objects), except that the characters in
`keep_latex_chars` are to be interpreted as LaTeX and are not to be further
encoded.

.. versionadded: 2.10
c           
      ó„   >• UnUc  S/n[         [        U ]
  " SS[        [        U R
                  SS9/U-   0UD6  Xl        g )NÚdefaultsÚconversion_rulesÚnone)Ú	rule_typeÚruleÚreplacement_latex_protection© )Úsuperr   Ú__init__r   r   Ú_do_partial_latex_encode_stepÚkeep_latex_chars)Úselfr   r   ÚkwargsÚbase_conversion_rulesÚ	__class__s        €Új/home/mande/repo/quber/.venv/lib/python3.13/site-packages/pylatexenc/latexencode/_partial_latex_encoder.pyr   Ú#PartialLatexToLatexEncoder.__init__E   sh   ø€ ð
 !1ÐØ Ñ(Ø%/ LÐ!äÔ(¨$Ò8ñ 		
ô ;Ü'Ø×7Ñ7Ø-3ñð ð 'ñ	'ð		
ð ò		
ð !1Õó    c                 ó  • SSK Jn  X   U R                  ;   ag  U" USS9nUR                  USS9nUR                  XR
                  UR
                  UR                  -    -   nUR
                  UR                  -   U-
  U4$ g)a)  
This method is used as a "callable rule" for the
:py:class:`UnicodeToLatexEncoder` object.

The strategy is to see if we have something that looks like a LaTeX char
we want to keep.  If so, keep it as is; if not, return `None` so that
further rules can be considered by the base unicode encoder.
é   )ÚLatexWalkerF)Útolerant_parsing)ÚenvironmentsN)Úlatexwalkerr"   r   Ú	get_tokenÚ	pre_spaceÚposÚlen)r   Úsr(   r"   ÚlwÚtokÚtok_as_latexs          r   r   Ú8PartialLatexToLatexEncoder._do_partial_latex_encode_step\   sy   € õ 	.à‰6�T×*Ñ*Ó*á˜Q°Ñ7ˆBà—,‘,˜s°�,Ð7ˆCàŸ=™=¨1¯W©W°s·w±w¸s¿w¹w±Ð+GÑGˆLð —G‘G˜CŸG™G‘O cÑ)¨<Ð8Ð8àr   )r   )z\${}^_N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   Ú__static_attributes__Ú__classcell__)r   s   @r   r   r   .   s   ø† ñð0 ?C÷1÷.ð r   r   )Ú
__future__r   r   r   ÚloggingÚ	getLoggerr/   ÚloggerÚ_unicode_to_latex_encoderr   r   r	   r   r   r   r   Ú<module>r;      s<   ð÷4 IÑ Hó à	×	Ò	˜8Ó	$€÷ñ ôEÐ!6õ Er   