B
    [                 @   sX   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 ZG d	d
 d
e
ZdS )zHTML slide show Exporter class    )deepcopy)warn)BoolUnicodedefault   )HTMLExporterc             C   sV  t | } x(| jD ]}|jdi dd|j_qW xHt| jD ]2\}}|jjdkr>d|j_d|j_d|j_|}P q>W tdd}xt| j|d	 d
 |d	 dD ]\}}| j|d	  }|jjdkrd|j_	d|j_|jjdkr||j_
d|j_d|j_d}q|jjdkrd|j_|r d|j_
qd}qW || jd j_
d| jd j_d| jd j_	| S )z>Add some convenience metadata on cells for the slide template.Z	slideshow
slide_type->   notesskipslideTz-All cells are hidden, cannot create slideshowFr   N)start>   r   subslideZfragment)r   ZcellsZmetadatagetr	   	enumerateZslide_startZsubslide_start
ValueErrorZ	slide_endZfragment_endZsubslide_endZfragment_start)nbZcellindexZfirst_slide_ixZin_fragmentZprevious_cell r   9lib/python3.7/site-packages/nbconvert/exporters/slides.pyprepare   s@    
r   c                   s   e Zd ZdZ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 Zeddd ZdZd  fdd	Z  ZS )!SlidesExporterz"Exports HTML slides with reveal.jsZslidesaG  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 krtd | j jjS dS )Nz!RevealHelpPreprocessor.url_prefixzdPlease update RevealHelpPreprocessor.url_prefix to SlidesExporter.reveal_url_prefix in config files.z6https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.5.0)r   r   ZRevealHelpPreprocessor
url_prefix)selfr   r   r   _reveal_url_prefix_defaulta   s    

z)SlidesExporter._reveal_url_prefix_defaultZ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
        zGhttps://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.jszW
        URL to load require.js from.

        Defaults to loading from cdnjs.
        zAhttps://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.jszS
        URL to load jQuery from.

        Defaults to loading from cdnjs.
        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.
        Zfile_extensionc             C   s   dS )Nz.slides.htmlr   )r   r   r   r   _file_extension_default   s    z&SlidesExporter._file_extension_defaultZtemplate_filec             C   s   dS )Nzslides_reveal.tplr   )r   r   r   r   _template_file_default   s    z%SlidesExporter._template_file_defaultz	text/htmlNc                s   |  |}d|kri |d< | j|d d< | j|d d< | j|d d< | j|d d< | j|d d< | j|d d< | j|d d< t|}t	t
| j|fd	|i|S )
NZrevealr   ZthemeZ
transitionZscrollrequire_js_url
jquery_urlfont_awesome_url	resources)Z_init_resourcesr   reveal_themereveal_transitionreveal_scrollr"   r#   r$   r   superr   from_notebook_node)r   r   r%   kw)	__class__r   r   r*      s    
z!SlidesExporter.from_notebook_node)N)__name__
__module____qualname____doc__Zexport_from_notebookr   tagr   r   r   r&   r'   r   r(   r"   r#   r$   r    r!   Zoutput_mimetyper*   __classcell__r   r   )r,   r   r   K   s>   	r   N)r0   copyr   warningsr   Z	traitletsr   r   r   Zhtmlr   r   r   r   r   r   r   <module>   s   >