o
    tf                     @   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 )NZ	slideshow
slide_type->   notesskipslideTz-All cells are hidden, cannot create slideshowFr   )start>   r   Zsubslidefragment)r   cellsmetadatagetAttributeErrorr   	enumerateZslide_startZsubslide_start
ValueErrorZ	slide_endZfragment_endZsubslide_endZfragment_start)
selfnb	resourcescellr   indexZfirst_slide_ixmsgZin_fragmentZprevious_cell r   c/var/www/html/software/conda/envs/catlas/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 slidesZtemplate_namec                 C      dS )Nrevealr   r   r   r   r    _template_name_default[      z%SlidesExporter._template_name_defaultZfile_extensionc                 C   r&   )Nz.slides.htmlr   r(   r   r   r    _file_extension_default_   r*   z&SlidesExporter._file_extension_defaultZtemplate_extensionc                 C   r&   )Nz.html.j2r   r(   r   r   r    _template_extension_defaultc   r*   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   ZRevealHelpPreprocessor
url_prefixr(   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 )	Nr'   r2   themeZ
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    r<      s   zSlidesExporter._init_resources)r"   r#   r$   __doc__Zexport_from_notebookr   r)   r+   r,   r   tagr/   r3   r=   r>   r   r?   r@   rB   rA   Zfont_awesome_urlr<   __classcell__r   r   rC   r    r%   T   sv    





			r%   N)rE   copyr   warningsr   Z	traitletsr   r   r   Znbconvert.preprocessors.baser   htmlr	   r
   r%   r   r   r   r    <module>   s    D