a
    ø£BeA  ã                   @   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   sv  t |ƒ}|jD ]>}z|j di ¡ dd¡}W n tyB   d}Y n0 ||j_qt|jƒD ]4\}}|jjdvrXd|j_d|j_d|j_|} qšqXd}t	|ƒ‚d}t|j|d	 d … |d	 d
�D ]†\}}|j|d	  }	|jjdkrîd|	j_
d|j_|jjdv �r||	j_d|	j_d|j_d}q¼|jjdkr¼d|j_|�r>d|	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   ú]/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/nbconvert/exporters/slides.pyÚ
preprocess   sH    


&
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‡ fdd„Z‡  ZS )ÚSlidesExporterz"Exports HTML slides with reveal.jszReveal.js slidesZtemplate_namec                 C   s   dS )NÚrevealr   ©r   r   r   r    Ú_template_name_default[   s    z%SlidesExporter._template_name_defaultZfile_extensionc                 C   s   dS )Nz.slides.htmlr   r'   r   r   r    Ú_file_extension_default_   s    z&SlidesExporter._file_extension_defaultZtemplate_extensionc                 C   s   dS )Nz.html.j2r   r'   r   r   r    Ú_template_extension_defaultc   s    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
        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                    sf   t ƒ  |¡}d|vri |d< | j|d d< | j|d d< | j|d d< | j|d d< | j|d d< |S )Nr&   r0   ÚthemeZ
transitionÚscrollÚnumber)ÚsuperÚ_init_resourcesr-   Úreveal_themeÚreveal_transitionÚreveal_scrollÚreveal_number)r   r   ©Ú	__class__r   r    r8   ´   s    zSlidesExporter._init_resources)r"   r#   r$   Ú__doc__Zexport_from_notebookr   r(   r)   r*   r   Útagr-   r1   r9   r:   r   r;   r<   Zfont_awesome_urlr8   Ú__classcell__r   r   r=   r    r%   T   s\   


ÿñ

þõþø
þûþúþù	r%   N)r?   Úcopyr   Úwarningsr   Z	traitletsr   r   r   Znbconvert.preprocessors.baser   Úhtmlr	   r
   r%   r   r   r   r    Ú<module>   s   D