##// END OF EJS Templates
Merge pull request #5957 from damianavila/fragments...
Min RK -
r17105:e181fce2 merge
parent child Browse files
Show More
@@ -53,7 +53,7 b' class ServePostProcessor(PostProcessorBase):'
53 open_in_browser = Bool(True, config=True,
53 open_in_browser = Bool(True, config=True,
54 help="""Should the browser be opened automatically?"""
54 help="""Should the browser be opened automatically?"""
55 )
55 )
56 reveal_cdn = Unicode("https://cdn.jsdelivr.net/reveal.js/2.5.0", config=True,
56 reveal_cdn = Unicode("https://cdn.jsdelivr.net/reveal.js/2.6.2", config=True,
57 help="""URL for reveal.js CDN."""
57 help="""URL for reveal.js CDN."""
58 )
58 )
59 reveal_prefix = Unicode("reveal.js", config=True, help="URL prefix for reveal.js")
59 reveal_prefix = Unicode("reveal.js", config=True, help="URL prefix for reveal.js")
@@ -49,13 +49,25 b' class RevealHelpPreprocessor(Preprocessor):'
49 #Make sure the cell has slideshow metadata.
49 #Make sure the cell has slideshow metadata.
50 cell.metadata.slide_type = cell.get('metadata', {}).get('slideshow', {}).get('slide_type', '-')
50 cell.metadata.slide_type = cell.get('metadata', {}).get('slideshow', {}).get('slide_type', '-')
51
51
52 #Get the slide type. If type is start of subslide or slide,
52 #Get the slide type. If type is start of subslide or slide,
53 #end the last subslide/slide.
53 #end the last subslide/slide.
54 if cell.metadata.slide_type in ['slide']:
54 if cell.metadata.slide_type in ['slide']:
55 worksheet.cells[index - 1].metadata.slide_helper = 'slide_end'
55 worksheet.cells[index - 1].metadata.slide_helper = 'slide_end'
56 if cell.metadata.slide_type in ['subslide']:
56 if cell.metadata.slide_type in ['subslide']:
57 worksheet.cells[index - 1].metadata.slide_helper = 'subslide_end'
57 worksheet.cells[index - 1].metadata.slide_helper = 'subslide_end'
58
58 #Prevent the rendering of "do nothing" cells before fragments
59 #Group fragments passing frag_number to the data-fragment-index
60 if cell.metadata.slide_type in ['fragment']:
61 worksheet.cells[index].metadata.frag_number = index
62 i = 1
63 while i < len(worksheet.cells) - index:
64 worksheet.cells[index + i].metadata.frag_helper = 'fragment_end'
65 worksheet.cells[index + i].metadata.frag_number = index
66 i += 1
67 #Restart the slide_helper when the cell status is changed
68 #to other types.
69 if cell.metadata.slide_type in ['-', 'skip', 'notes', 'fragment']:
70 worksheet.cells[index - 1].metadata.slide_helper = '-'
59
71
60 if not isinstance(resources['reveal'], dict):
72 if not isinstance(resources['reveal'], dict):
61 resources['reveal'] = {}
73 resources['reveal'] = {}
@@ -28,11 +28,11 b' class Testrevealhelp(PreprocessorTestsBase):'
28 """Contains test functions for revealhelp.py"""
28 """Contains test functions for revealhelp.py"""
29
29
30 def build_notebook(self):
30 def build_notebook(self):
31 """Build a reveal slides notebook in memory for use with tests.
31 """Build a reveal slides notebook in memory for use with tests.
32 Overrides base in PreprocessorTestsBase"""
32 Overrides base in PreprocessorTestsBase"""
33
33
34 outputs = [nbformat.new_output(output_type="stream", stream="stdout", output_text="a")]
34 outputs = [nbformat.new_output(output_type="stream", stream="stdout", output_text="a")]
35
35
36 slide_metadata = {'slideshow' : {'slide_type': 'slide'}}
36 slide_metadata = {'slideshow' : {'slide_type': 'slide'}}
37 subslide_metadata = {'slideshow' : {'slide_type': 'subslide'}}
37 subslide_metadata = {'slideshow' : {'slide_type': 'subslide'}}
38
38
@@ -56,7 +56,7 b' class Testrevealhelp(PreprocessorTestsBase):'
56 def test_constructor(self):
56 def test_constructor(self):
57 """Can a RevealHelpPreprocessor be constructed?"""
57 """Can a RevealHelpPreprocessor be constructed?"""
58 self.build_preprocessor()
58 self.build_preprocessor()
59
59
60
60
61 def test_reveal_attribute(self):
61 def test_reveal_attribute(self):
62 """Make sure the reveal url_prefix resources is set"""
62 """Make sure the reveal url_prefix resources is set"""
@@ -82,7 +82,8 b' class Testrevealhelp(PreprocessorTestsBase):'
82
82
83 # Make sure slide end is only applied to the cells preceeding slide
83 # Make sure slide end is only applied to the cells preceeding slide
84 # cells.
84 # cells.
85 assert 'slide_helper' not in cells[1].metadata
85 assert 'slide_helper' in cells[1].metadata
86 self.assertEqual(cells[1].metadata['slide_helper'], '-')
86
87
87 # Verify 'slide-end'
88 # Verify 'slide-end'
88 assert 'slide_helper' in cells[0].metadata
89 assert 'slide_helper' in cells[0].metadata
@@ -10,7 +10,13 b''
10 <section>
10 <section>
11 {{ super() }}
11 {{ super() }}
12 {%- elif cell.metadata.slide_type in ['-'] -%}
12 {%- elif cell.metadata.slide_type in ['-'] -%}
13 {{ super() }}
13 {%- if cell.metadata.frag_helper in ['fragment_end'] -%}
14 <div class="fragment" data-fragment-index="{{ cell.metadata.frag_number }}">
15 {{ super() }}
16 </div>
17 {%- else -%}
18 {{ super() }}
19 {%- endif -%}
14 {%- elif cell.metadata.slide_type in ['skip'] -%}
20 {%- elif cell.metadata.slide_type in ['skip'] -%}
15 <div style=display:none>
21 <div style=display:none>
16 {{ super() }}
22 {{ super() }}
@@ -20,7 +26,7 b''
20 {{ super() }}
26 {{ super() }}
21 </aside>
27 </aside>
22 {%- elif cell.metadata.slide_type in ['fragment'] -%}
28 {%- elif cell.metadata.slide_type in ['fragment'] -%}
23 <div class="fragment">
29 <div class="fragment" data-fragment-index="{{ cell.metadata.frag_number }}">
24 {{ super() }}
30 {{ super() }}
25 </div>
31 </div>
26 {%- endif -%}
32 {%- endif -%}
General Comments 0
You need to be logged in to leave comments. Login now