§
    ŽŸjü  ã                   ó˜   — d Z ddlZddlZddlmZ ddlmZ ddlmZm	Z	m
Z
 ddlmZ 	 ddlmZ n# e$ r dZY nw xY w G d	„ d
e¦  «        ZdS )z:Module that pre-processes the notebook for export to HTML.é    N)ÚJupyterStyle)ÚStyle)ÚTypeÚUnicodeÚUnioné   )ÚPreprocessor)ÚDEFAULT_STATIC_FILES_PATHc                   óÚ   — e Zd ZdZ edd¬¦  «                             d¬¦  «        Z e ed¦  «         ee	¬¦  «        gd	e
¬
¦  «                             d¬¦  «        Zd„ Zd„ Zd„ Zd„ ZdS )ÚCSSHTMLHeaderPreprocessorzŽ
    Preprocessor used to pre-process notebook for HTML output.  Adds IPython notebook
    front-end CSS and Pygments CSS to HTML output.
    z
.highlightzCSS highlight class identifier)ÚhelpT)ÚconfigÚdefault)Úklassz!Name of the pygments style to use)r   Údefault_valuec                 ó>   — t          j        | g|¢R i |¤Ž d| _        dS )zInitialize the preprocessor.N)r	   Ú__init__Ú_default_css_hash)ÚselfÚpargsÚkwargss      úr/var/www/finuniver-perm.ru/html/student/venv/lib/python3.11/site-packages/nbconvert/preprocessors/csshtmlheader.pyr   z"CSSHTMLHeaderPreprocessor.__init__#   s1   € åÔ˜dÐ5 UÐ5Ð5Ð5¨fÐ5Ð5Ð5Ø!%ˆÔÐÐó    c                 óP   — i |d<   |                       |¦  «        |d         d<   ||fS )aã  Fetch and add CSS to the resource dictionary

        Fetch CSS from IPython and Pygments to add at the beginning
        of the html files.  Add this css in resources in the
        "inlining.css" key

        Parameters
        ----------
        nb : NotebookNode
            Notebook being converted
        resources : dictionary
            Additional resources used in the conversion process.  Allows
            preprocessors to pass variables into the Jinja engine.
        ÚinliningÚcss)Ú_generate_header)r   ÚnbÚ	resourcess      r   Ú
preprocessz$CSSHTMLHeaderPreprocessor.preprocess(   s5   € ð !#ˆ	�*ÑØ'+×'<Ò'<¸YÑ'GÔ'Gˆ	�*Ô˜eÑ$Ø�9ˆ}Ðr   c                 óš  — ddl m} g } || j        ¬¦  «        }|                     | j        ¦  «        }|                     |¦  «         |d         }t          j                             |dd¦  «        }t          j         	                    |¦  «        rºt          rE| j        €>|                      t          j                             t          dd¦  «        ¦  «        | _        |                      |¦  «        | j        k    rPt          |d¬	¦  «        5 }|                     |                     ¦   «         ¦  «         ddd¦  «         n# 1 swxY w Y   |S )
zb
        Fills self.header with lines of CSS extracted from IPython
        and Pygments.
        r   )ÚHtmlFormatter)ÚstyleÚ
config_dirÚcustomz
custom.cssNzutf-8)Úencoding)Úpygments.formattersr"   r#   Úget_style_defsÚhighlight_classÚappendÚosÚpathÚjoinÚisfiler
   r   Ú_hashÚopenÚread)	r   r   r"   ÚheaderÚ	formatterÚpygments_cssr$   Úcustom_css_filenameÚfs	            r   r   z*CSSHTMLHeaderPreprocessor._generate_header;   sp  € ð
 	6Ð5Ð5Ð5Ð5Ð5àˆà!�M¨¬
Ð3Ñ3Ô3ˆ	Ø ×/Ò/°Ô0DÑEÔEˆØ�Š�lÑ#Ô#Ð#ð
 ˜|Ô,ˆ
Ý œgŸlšl¨:°xÀÑNÔNÐÝŒ7�>Š>Ð-Ñ.Ô.ð 	,Ý(ð ¨TÔ-CÐ-KØ)-¯ªÝ”G—L’LÕ!:¸HÀlÑSÔSñ*ô *�Ô&ð �zŠzÐ-Ñ.Ô.°$Ô2HÒHÐHÝÐ-¸Ð@Ñ@Ô@ð ,ÀAØ—M’M !§&¢&¡(¤(Ñ+Ô+Ð+ð,ð ,ð ,ñ ,ô ,ð ,ð ,ð ,ð ,ð ,ð ,øøøð ,ð ,ð ,ð ,àˆs   Ä(E Å EÅEc                 óî   — t          j        ¦   «         }t          |d¦  «        5 }|                     |                     ¦   «         ¦  «         ddd¦  «         n# 1 swxY w Y   |                     ¦   «         S )zCompute the hash of a file.ÚrbN)ÚhashlibÚmd5r0   Úupdater1   Údigest)r   Úfilenamer:   r6   s       r   r/   zCSSHTMLHeaderPreprocessor._hashW   s—   € åŒk‰mŒmˆÝ�(˜DÑ!Ô!ð 	! QØ�JŠJ�q—v’v‘x”xÑ Ô Ð ð	!ð 	!ð 	!ñ 	!ô 	!ð 	!ð 	!ð 	!ð 	!ð 	!ð 	!øøøð 	!ð 	!ð 	!ð 	!à�zŠz‰|Œ|Ðs   ¤(AÁAÁAN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Útagr)   r   r   r   r   r#   r   r    r   r/   © r   r   r   r      sÒ   € € € € € ðð ð
 �g˜lÐ1QÐRÑRÔR×VÒVÐ^bÐVÑcÔc€OàˆEØ	ˆ�Ñ	Ô	˜T˜T¨Ð.Ñ.Ô.Ð/Ø0Ø"ðñ ô ÷ 
‚c�€cÑÔð	 
ð&ð &ð &ð
ð ð ð&ð ð ð8ð ð ð ð r   r   )rA   r9   r+   Újupyterlab_pygmentsr   Úpygments.styler   Ú	traitletsr   r   r   Úbaser	   Únotebookr
   ÚImportErrorr   rC   r   r   ú<module>rJ      sò   ðØ @Ð @ð
 €€€Ø 	€	€	€	à ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø  Ð  Ð  Ð  Ð  Ð  Ø *Ð *Ð *Ð *Ð *Ð *Ð *Ð *Ð *Ð *à Ð Ð Ð Ð Ð ð%Ø2Ð2Ð2Ð2Ð2Ð2Ð2øØð %ð %ð %Ø $ÐÐÐð%øøøðGð Gð Gð Gð G ñ Gô Gð Gð Gð Gs   ¨/ ¯9¸9