o
    i                     @   sl   d 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 G dd	 d	e
ZG d
d deZdS )zHTML slide show Exporter class    )deepcopy)warn)BoolUnicodedefault)Preprocessor   )HTMLExporterc                   @   s   e Zd ZdddZdS )_RevealMetadataPreprocessorNc           
   	   C   sr  t |}|jD ]}z|jdi dd}W n ty!   d}Y nw ||j_qt|jD ]\}}|jjdvrFd|j_d|j_d|j_|} nq,d}t	|d}t|j|d	 d  |d	 d
D ]A\}}|j|d	  }	|jjdkrwd|	j_
d|j_|jjdv r||	j_d|	j_d|j_d}q^|jjdkrd|j_|rd|	j_q^d}q^||jd j_d|jd j_d|jd j_
||fS )N	slideshow
slide_type->   skipnotesslideTz-All cells are hidden, cannot create slideshowFr   )start>   r   subslidefragment)r   cellsmetadatagetAttributeErrorr   	enumerateslide_startsubslide_start
ValueError	slide_endfragment_endsubslide_endfragment_start)
selfnb	resourcescellr   indexfirst_slide_ixmsgin_fragmentprevious_cell r*   U/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/nbconvert/exporters/slides.py
preprocess   sN   

&
z&_RevealMetadataPreprocessor.preprocess)N)__name__
__module____qualname__r,   r*   r*   r*   r+   r
      s    r
   c                       s  e Zd ZdZdZeddd Zeddd Zed	d
d Ze	ddj
ddZeddd Ze	dddj
ddZe	dddj
ddZedddj
ddZe	dddj
ddZe	dddj
ddZe	dddj
ddZe	dddj
ddZ fdd Z  ZS )!SlidesExporterz"Exports HTML slides with reveal.jszReveal.js slidestemplate_namec                 C      dS )Nrevealr*   r!   r*   r*   r+   _template_name_default[      z%SlidesExporter._template_name_defaultfile_extensionc                 C   r2   )Nz.slides.htmlr*   r4   r*   r*   r+   _file_extension_default_   r6   z&SlidesExporter._file_extension_defaulttemplate_extensionc                 C   r2   )Nz.html.j2r*   r4   r*   r*   r+   _template_extension_defaultc   r6   z*SlidesExporter._template_extension_defaulta,  The URL prefix for reveal.js (version 3.x).
        This defaults to the reveal CDN, but can be any url pointing to a copy
        of reveal.js.

        For speaker notes to work, this must be a relative path to a local
        copy of reveal.js: e.g., "reveal.js".

        If a relative path is given, it must be a subdirectory of the
        current directory (from which the server is run).

        See the usage documentation
        (https://nbconvert.readthedocs.io/en/latest/usage.html#reveal-js-html-slideshow)
        for more details.
        )helpT)configreveal_url_prefixc                 C   s$   d| j v rtddd | j jjS dS )Nz!RevealHelpPreprocessor.url_prefixzdPlease update RevealHelpPreprocessor.url_prefix to SlidesExporter.reveal_url_prefix in config files.   )
stacklevelz!https://unpkg.com/reveal.js@4.0.2)r<   r   RevealHelpPreprocessor
url_prefixr4   r*   r*   r+   _reveal_url_prefix_defaultz   s   

z)SlidesExporter._reveal_url_prefix_defaultsimplea(  
        Name of the reveal.js theme to use.

        We look for a file with this name under
        ``reveal_url_prefix``/css/theme/``reveal_theme``.css.

        https://github.com/hakimel/reveal.js/tree/master/css/theme has
        list of themes that ship by default with reveal.js.
        r   z
        Name of the reveal.js transition to use.

        The list of transitions that ships by default with reveal.js are:
        none, fade, slide, convex, concave and zoom.
        Fz=
        If True, enable scrolling within each slide
         z
        slide number format (e.g. 'c/t'). Choose from:
        'c': current, 't': total, 'h': horizontal, 'v': vertical
        z
        width used to determine the aspect ratio of your presentation.
        Use the horizontal pixels available on your intended presentation
        equipment.
        z
        height used to determine the aspect ratio of your presentation.
        Use the horizontal pixels available on your intended presentation
        equipment.
        zNhttps://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.csszY
        URL to load font awesome from.

        Defaults to loading from cdnjs.
        c                    s   t  |}d|vri |d< | j|d d< | j|d d< | j|d d< | j|d d< | j|d d< | j|d d< | j|d d< |S )	Nr3   rA   theme
transitionscrollnumberheightwidth)	super_init_resourcesr=   reveal_themereveal_transitionreveal_scrollreveal_numberreveal_heightreveal_width)r!   r#   	__class__r*   r+   rL      s   zSlidesExporter._init_resources)r-   r.   r/   __doc__export_from_notebookr   r5   r8   r:   r   tagr=   rB   rM   rN   r   rO   rP   rR   rQ   font_awesome_urlrL   __classcell__r*   r*   rS   r+   r0   T   sv    





			r0   N)rU   copyr   warningsr   	traitletsr   r   r   nbconvert.preprocessors.baser   htmlr	   r
   r0   r*   r*   r*   r+   <module>   s    D