##// END OF EJS Templates
don't allow 'template' to specify 'template_file'...
don't allow 'template' to specify 'template_file' must use template_file explicitly

File last commit:

r11452:69026871
r11852:c600f1e5
Show More
revealhelp.py
61 lines | 2.5 KiB | text/x-python | PythonLexer
Jonathan Frederic
Cleanup and refactor, transformers
r10674 """Module that pre-processes the notebook for export via Reveal.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
MinRK
s/ConfigurableTransformer/Transformer/
r11452 from .base import Transformer
damianavila
Added some changes covering Mathias's commentaries.
r11183 from IPython.utils.traitlets import Unicode
damianavila
Added white line after imports.
r11181
Jonathan Frederic
Cleanup and refactor, transformers
r10674 #-----------------------------------------------------------------------------
# Classes and functions
#-----------------------------------------------------------------------------
MinRK
s/ConfigurableTransformer/Transformer/
r11452 class RevealHelpTransformer(Transformer):
Jonathan Frederic
Split transformer code
r10437
damianavila
Added some changes covering Mathias's commentaries.
r11183 url_prefix = Unicode('//cdn.jsdelivr.net/reveal.js/2.4.0',
config=True,
help="""If you want to use a local reveal.js library,
use 'url_prefix':'reveal.js' in your config object.""")
damianavila
Make configurable the url where look for reveal.js library.
r11179
damianavila
Fixed css in template and call() in reveal help.
r10851 def call(self, nb, resources):
Jonathan Frederic
Cleanup and refactor, transformers
r10674 """
Called once to 'transform' contents of the notebook.
damianavila
Added some changes covering Mathias's commentaries.
r11183
Jonathan Frederic
Cleanup and refactor, transformers
r10674 Parameters
----------
nb : NotebookNode
Notebook being converted
resources : dictionary
Additional resources used in the conversion process. Allows
transformers to pass variables into the Jinja engine.
"""
damianavila
Added some changes covering Mathias's commentaries.
r11183
Jonathan Frederic
Split transformer code
r10437 for worksheet in nb.worksheets :
Jonathan Frederic
Added writers and supporting code.
r11367 for index, cell in enumerate(worksheet.cells):
damianavila
Fixed reveal in the new nbconvert to make it work.
r10823
#Make sure the cell has slideshow metadata.
damianavila
Added changes to understand alignment metadata for each cells.
r10947 cell.metadata.align_type = cell.get('metadata', {}).get('slideshow', {}).get('align_type', 'Left')
damianavila
Fixed reveal in the new nbconvert to make it work.
r10823 cell.metadata.slide_type = cell.get('metadata', {}).get('slideshow', {}).get('slide_type', '-')
Jonathan Frederic
Cleanup and refactor, transformers
r10674 #Get the slide type. If type is start of subslide or slide,
#end the last subslide/slide.
Jonathan Frederic
Split transformer code
r10437 if cell.metadata.slide_type in ['slide']:
Jonathan Frederic
Added writers and supporting code.
r11367 worksheet.cells[index - 1].metadata.slide_helper = 'slide_end'
Jonathan Frederic
Split transformer code
r10437 if cell.metadata.slide_type in ['subslide']:
Jonathan Frederic
Added writers and supporting code.
r11367 worksheet.cells[index - 1].metadata.slide_helper = 'subslide_end'
damianavila
Make configurable the url where look for reveal.js library.
r11179
damianavila
Added some changes covering Mathias's commentaries.
r11183
damianavila
Added look for key 'reveal' to not overwrite it.
r11184 if 'reveal' not in resources:
resources['reveal'] = {}
damianavila
Added some changes covering Mathias's commentaries.
r11183 resources['reveal']['url_prefix'] = self.url_prefix
Jonathan Frederic
Cleanup and refactor, transformers
r10674 return nb, resources