a
    Zä%b  ã                   @   sj   d dl Z ddlmZ ddlmZ ddddd	d
dddddddddœZdd„ Ze  deeƒ ¡Zddd„Z	dS )é    Né   )ÚLatexBuildError)Ú	build_pdfz\&z\%z\$z\#z\_z\{z\}z\textasciitilde{}z\textasciicircum{}z\textbackslash{}z\textless{}z\textgreater{}z
\textbar{}z\textquotedbl{})ú&ú%ú$ú#Ú_Ú{Ú}ú~ú^ú\ú<ú>ú|ú"c                 C   s   d  dd„ t|  ¡ ƒD ƒ¡S )Nr   c                 s   s   | ]}t  |¡V  qd S )N)ÚreÚescape)Ú.0Úk© r   ú^/Users/vegardjervell/Documents/master/model/venv/lib/python3.9/site-packages/latex/__init__.pyÚ	<genexpr>   ó    z_sub_tbl.<locals>.<genexpr>)ÚjoinÚsortedÚkeys)Ztblr   r   r   Ú_sub_tbl   s    r   z\n+|Tc                    s   ‡ fdd„}t  || ¡S )aw  Escapes a string to make it usable in LaTeX text mode. Will replace
    special characters as well as newlines.

    :param s: The string to escape.
    :param fold_newlines: If true, multiple newlines will be reduced to just a
                          single ``\``. Otherwise, whitespace is kept intact
                          by adding multiple ``[naselineskip]``.
    c                    s:   |   ¡ }|tv rt| S | ¡ r6ˆ r(dS d t|ƒ¡S d S )Nz\\z\\[{}\baselineskip])ÚgroupÚCHAR_ESCAPEÚisspaceÚformatÚlen)ÚmÚc©Úfold_newlinesr   r   Úsub+   s    zescape.<locals>.sub)Ú	ESCAPE_REr(   )Úsr'   r(   r   r&   r   r   !   s    

r   )T)
r   Úexcr   Úbuildr   r    r   Úcompiler)   r   r   r   r   r   Ú<module>   s(   ð