##// END OF EJS Templates
Added changes to understand alignment metadata for each cells.
damianavila -
Show More
@@ -0,0 +1,17 b''
1 {%- extends 'reveal_cells.tpl' -%}
2
3
4
5 {%- block any_cell scoped -%}
6 {%- if cell.metadata.align_type in ['Left'] -%}
7 {{ super() }}
8 {%- elif cell.metadata.align_type in ['center'] -%}
9 <div style="text-align:center">
10 {{ super() }}
11 </div>
12 {%- elif cell.metadata.align_type in ['right'] -%}
13 <div style="text-align:right">
14 {{ super() }}
15 </div>
16 {%- endif -%}
17 {%- endblock any_cell -%}
@@ -1,15 +1,15 b''
1 {%- extends 'reveal_cells.tpl' -%}
1 {%- extends 'align_reveal_cells.tpl' -%}
2
2
3
3
4
4
5 {%- block any_cell scoped -%}
5 {%- block any_cell scoped -%}
6 {%- if cell.metadata.slide_type in ['subslide'] -%}
6 {%- if cell.metadata.slide_type in ['subslide'] -%}
7 <section>
7 <section>
8 {%- endif -%}
8 {%- endif -%}
9
9
10 {{ super() }}
10 {{ super() }}
11
11
12 {%- if cell.metadata.slide_helper in ['subslide_end'] -%}
12 {%- if cell.metadata.slide_helper in ['subslide_end'] -%}
13 </section>
13 </section>
14 {%- endif -%}
14 {%- endif -%}
15 {%- endblock any_cell -%}
15 {%- endblock any_cell -%}
@@ -1,51 +1,52 b''
1 """Module that pre-processes the notebook for export via Reveal.
1 """Module that pre-processes the notebook for export via Reveal.
2 """
2 """
3 #-----------------------------------------------------------------------------
3 #-----------------------------------------------------------------------------
4 # Copyright (c) 2013, the IPython Development Team.
4 # Copyright (c) 2013, the IPython Development Team.
5 #
5 #
6 # Distributed under the terms of the Modified BSD License.
6 # Distributed under the terms of the Modified BSD License.
7 #
7 #
8 # The full license is in the file COPYING.txt, distributed with this software.
8 # The full license is in the file COPYING.txt, distributed with this software.
9 #-----------------------------------------------------------------------------
9 #-----------------------------------------------------------------------------
10
10
11 #-----------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------
12 # Imports
12 # Imports
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14
14
15 from .base import ConfigurableTransformer
15 from .base import ConfigurableTransformer
16
16
17 #-----------------------------------------------------------------------------
17 #-----------------------------------------------------------------------------
18 # Classes and functions
18 # Classes and functions
19 #-----------------------------------------------------------------------------
19 #-----------------------------------------------------------------------------
20
20
21 class RevealHelpTransformer(ConfigurableTransformer):
21 class RevealHelpTransformer(ConfigurableTransformer):
22
22
23 def call(self, nb, resources):
23 def call(self, nb, resources):
24 """
24 """
25 Called once to 'transform' contents of the notebook.
25 Called once to 'transform' contents of the notebook.
26
26
27 Parameters
27 Parameters
28 ----------
28 ----------
29 nb : NotebookNode
29 nb : NotebookNode
30 Notebook being converted
30 Notebook being converted
31 resources : dictionary
31 resources : dictionary
32 Additional resources used in the conversion process. Allows
32 Additional resources used in the conversion process. Allows
33 transformers to pass variables into the Jinja engine.
33 transformers to pass variables into the Jinja engine.
34 """
34 """
35
35
36
36
37 for worksheet in nb.worksheets :
37 for worksheet in nb.worksheets :
38 for i, cell in enumerate(worksheet.cells):
38 for i, cell in enumerate(worksheet.cells):
39
39
40 #Make sure the cell has slideshow metadata.
40 #Make sure the cell has slideshow metadata.
41 cell.metadata.align_type = cell.get('metadata', {}).get('slideshow', {}).get('align_type', 'Left')
41 cell.metadata.slide_type = cell.get('metadata', {}).get('slideshow', {}).get('slide_type', '-')
42 cell.metadata.slide_type = cell.get('metadata', {}).get('slideshow', {}).get('slide_type', '-')
42
43
43 #Get the slide type. If type is start of subslide or slide,
44 #Get the slide type. If type is start of subslide or slide,
44 #end the last subslide/slide.
45 #end the last subslide/slide.
45 if cell.metadata.slide_type in ['slide']:
46 if cell.metadata.slide_type in ['slide']:
46 worksheet.cells[i - 1].metadata.slide_helper = 'slide_end'
47 worksheet.cells[i - 1].metadata.slide_helper = 'slide_end'
47 if cell.metadata.slide_type in ['subslide']:
48 if cell.metadata.slide_type in ['subslide']:
48 worksheet.cells[i - 1].metadata.slide_helper = 'subslide_end'
49 worksheet.cells[i - 1].metadata.slide_helper = 'subslide_end'
49
50
50 return nb, resources
51 return nb, resources
51 No newline at end of file
52
General Comments 0
You need to be logged in to leave comments. Login now