##// END OF EJS Templates
don't allow 'template' to specify 'template_file'...
MinRK -
Show More
@@ -170,11 +170,13 b' class Exporter(LoggingConfigurable):'
170 template : str (optional, kw arg)
170 template : str (optional, kw arg)
171 Template to use when exporting.
171 Template to use when exporting.
172 """
172 """
173 if not config:
174 config = self.default_config
173
175
174 super(Exporter, self).__init__(config=config, **kw)
176 super(Exporter, self).__init__(config=config, **kw)
175
177
176 #Init
178 #Init
177 self._init_template(**kw)
179 self._init_template()
178 self._init_environment(extra_loaders=extra_loaders)
180 self._init_environment(extra_loaders=extra_loaders)
179 self._init_transformers()
181 self._init_transformers()
180 self._init_filters()
182 self._init_filters()
@@ -189,8 +191,9 b' class Exporter(LoggingConfigurable):'
189 c = self.default_config
191 c = self.default_config
190 if new:
192 if new:
191 c.merge(new)
193 c.merge(new)
192 if c != new:
194 if c != old:
193 self.config = c
195 self.config = c
196 super(Exporter, self)._config_changed(name, old, c)
194
197
195
198
196 def _load_template(self):
199 def _load_template(self):
@@ -382,14 +385,12 b' class Exporter(LoggingConfigurable):'
382 raise TypeError('filter')
385 raise TypeError('filter')
383
386
384
387
385 def _init_template(self, **kw):
388 def _init_template(self):
386 """
389 """
387 Make sure a template name is specified. If one isn't specified, try to
390 Make sure a template name is specified. If one isn't specified, try to
388 build one from the information we know.
391 build one from the information we know.
389 """
392 """
390 self._template_file_changed('template_file', self.template_file, self.template_file)
393 self._template_file_changed('template_file', self.template_file, self.template_file)
391 if 'template' in kw:
392 self.template_file = kw['template']
393
394
394
395
395 def _init_environment(self, extra_loaders=None):
396 def _init_environment(self, extra_loaders=None):
@@ -95,7 +95,7 b' class TestExporter(ExportersTestsBase):'
95
95
96 def test_transformer_via_method(self):
96 def test_transformer_via_method(self):
97 """
97 """
98 Can a transformer be added via the Exporter convinience method?
98 Can a transformer be added via the Exporter convenience method?
99 """
99 """
100 exporter = self._make_exporter()
100 exporter = self._make_exporter()
101 exporter.register_transformer(CheeseTransformer, enabled=True)
101 exporter.register_transformer(CheeseTransformer, enabled=True)
@@ -108,6 +108,5 b' class TestExporter(ExportersTestsBase):'
108 def _make_exporter(self, config=None):
108 def _make_exporter(self, config=None):
109 #Create the exporter instance, make sure to set a template name since
109 #Create the exporter instance, make sure to set a template name since
110 #the base Exporter doesn't have a template associated with it.
110 #the base Exporter doesn't have a template associated with it.
111 exporter = Exporter(config=config)
111 exporter = Exporter(config=config, template_file='python')
112 exporter.template_file = 'python'
113 return exporter No newline at end of file
112 return exporter
@@ -46,7 +46,7 b' class TestHTMLExporter(ExportersTestsBase):'
46 """
46 """
47 Can a HTMLExporter export using the 'basic' template?
47 Can a HTMLExporter export using the 'basic' template?
48 """
48 """
49 (output, resources) = HTMLExporter(template='basic').from_filename(self._get_notebook())
49 (output, resources) = HTMLExporter(template_file='basic').from_filename(self._get_notebook())
50 assert len(output) > 0
50 assert len(output) > 0
51
51
52
52
@@ -55,5 +55,5 b' class TestHTMLExporter(ExportersTestsBase):'
55 """
55 """
56 Can a HTMLExporter export using the 'full' template?
56 Can a HTMLExporter export using the 'full' template?
57 """
57 """
58 (output, resources) = HTMLExporter(template='full').from_filename(self._get_notebook())
58 (output, resources) = HTMLExporter(template_file='full').from_filename(self._get_notebook())
59 assert len(output) > 0
59 assert len(output) > 0
@@ -46,7 +46,7 b' class TestLatexExporter(ExportersTestsBase):'
46 """
46 """
47 Can a LatexExporter export using 'book' template?
47 Can a LatexExporter export using 'book' template?
48 """
48 """
49 (output, resources) = LatexExporter(template='book').from_filename(self._get_notebook())
49 (output, resources) = LatexExporter(template_file='book').from_filename(self._get_notebook())
50 assert len(output) > 0
50 assert len(output) > 0
51
51
52
52
@@ -55,7 +55,7 b' class TestLatexExporter(ExportersTestsBase):'
55 """
55 """
56 Can a LatexExporter export using 'basic' template?
56 Can a LatexExporter export using 'basic' template?
57 """
57 """
58 (output, resources) = LatexExporter(template='basic').from_filename(self._get_notebook())
58 (output, resources) = LatexExporter(template_file='basic').from_filename(self._get_notebook())
59 assert len(output) > 0
59 assert len(output) > 0
60
60
61
61
@@ -64,5 +64,5 b' class TestLatexExporter(ExportersTestsBase):'
64 """
64 """
65 Can a LatexExporter export using 'article' template?
65 Can a LatexExporter export using 'article' template?
66 """
66 """
67 (output, resources) = LatexExporter(template='article').from_filename(self._get_notebook())
67 (output, resources) = LatexExporter(template_file='article').from_filename(self._get_notebook())
68 assert len(output) > 0 No newline at end of file
68 assert len(output) > 0
@@ -46,5 +46,5 b' class TestSlidesExporter(ExportersTestsBase):'
46 """
46 """
47 Can a SlidesExporter export using the 'reveal' template?
47 Can a SlidesExporter export using the 'reveal' template?
48 """
48 """
49 (output, resources) = SlidesExporter(template='reveal').from_filename(self._get_notebook())
49 (output, resources) = SlidesExporter(template_file='reveal').from_filename(self._get_notebook())
50 assert len(output) > 0
50 assert len(output) > 0
General Comments 0
You need to be logged in to leave comments. Login now