Show More
@@ -1,7 +1,7 b'' | |||
|
1 | 1 | from .export import * |
|
2 | 2 | from .html import HTMLExporter |
|
3 | 3 | from .slides import SlidesExporter |
|
4 | from .exporter import Exporter | |
|
4 | from .exporter import TemplateExporter | |
|
5 | 5 | from .latex import LatexExporter |
|
6 | 6 | from .markdown import MarkdownExporter |
|
7 | 7 | from .python import PythonExporter |
@@ -1,4 +1,4 b'' | |||
|
1 | """This module defines Exporter, a highly configurable converter | |
|
1 | """This module defines BaseExporter, a highly configurable converter | |
|
2 | 2 | that uses Jinja2 to export notebook files into different formats. |
|
3 | 3 | """ |
|
4 | 4 |
@@ -18,7 +18,7 b' from functools import wraps' | |||
|
18 | 18 | from IPython.nbformat.v3.nbbase import NotebookNode |
|
19 | 19 | from IPython.config import Config |
|
20 | 20 | |
|
21 | from .exporter import Exporter | |
|
21 | from .exporter import TemplateExporter | |
|
22 | 22 | from .html import HTMLExporter |
|
23 | 23 | from .slides import SlidesExporter |
|
24 | 24 | from .latex import LatexExporter |
@@ -100,14 +100,14 b' def export(exporter, nb, **kw):' | |||
|
100 | 100 | #Check arguments |
|
101 | 101 | if exporter is None: |
|
102 | 102 | raise TypeError("Exporter is None") |
|
103 | elif not isinstance(exporter, Exporter) and not issubclass(exporter, Exporter): | |
|
103 | elif not isinstance(exporter, TemplateExporter) and not issubclass(exporter, TemplateExporter): | |
|
104 | 104 | raise TypeError("exporter does not inherit from Exporter (base)") |
|
105 | 105 | if nb is None: |
|
106 | 106 | raise TypeError("nb is None") |
|
107 | 107 | |
|
108 | 108 | #Create the exporter |
|
109 | 109 | resources = kw.pop('resources', None) |
|
110 | if isinstance(exporter, Exporter): | |
|
110 | if isinstance(exporter, TemplateExporter): | |
|
111 | 111 | exporter_instance = exporter |
|
112 | 112 | else: |
|
113 | 113 | exporter_instance = exporter(**kw) |
@@ -122,7 +122,7 b' def export(exporter, nb, **kw):' | |||
|
122 | 122 | return output, resources |
|
123 | 123 | |
|
124 | 124 | exporter_map = dict( |
|
125 | custom=Exporter, | |
|
125 | custom=TemplateExporter, | |
|
126 | 126 | html=HTMLExporter, |
|
127 | 127 | slides=SlidesExporter, |
|
128 | 128 | latex=LatexExporter, |
@@ -19,13 +19,13 b' from IPython.utils.traitlets import Unicode, List' | |||
|
19 | 19 | from IPython.nbconvert import preprocessors |
|
20 | 20 | from IPython.config import Config |
|
21 | 21 | |
|
22 | from .exporter import Exporter | |
|
22 | from .exporter import TemplateExporter | |
|
23 | 23 | |
|
24 | 24 | #----------------------------------------------------------------------------- |
|
25 | 25 | # Classes |
|
26 | 26 | #----------------------------------------------------------------------------- |
|
27 | 27 | |
|
28 | class HTMLExporter(Exporter): | |
|
28 | class HTMLExporter(TemplateExporter): | |
|
29 | 29 | """ |
|
30 | 30 | Exports a basic HTML document. This exporter assists with the export of |
|
31 | 31 | HTML. Inherit from it if you are writing your own HTML template and need |
@@ -16,13 +16,13 b' Exporter that will export your ipynb to Markdown.' | |||
|
16 | 16 | from IPython.config import Config |
|
17 | 17 | from IPython.utils.traitlets import Unicode |
|
18 | 18 | |
|
19 | from .exporter import Exporter | |
|
19 | from .exporter import TemplateExporter | |
|
20 | 20 | |
|
21 | 21 | #----------------------------------------------------------------------------- |
|
22 | 22 | # Classes |
|
23 | 23 | #----------------------------------------------------------------------------- |
|
24 | 24 | |
|
25 | class MarkdownExporter(Exporter): | |
|
25 | class MarkdownExporter(TemplateExporter): | |
|
26 | 26 | """ |
|
27 | 27 | Exports to a markdown document (.md) |
|
28 | 28 | """ |
@@ -15,13 +15,13 b' Python exporter which exports Notebook code into a PY file.' | |||
|
15 | 15 | |
|
16 | 16 | from IPython.utils.traitlets import Unicode |
|
17 | 17 | |
|
18 | from .exporter import Exporter | |
|
18 | from .exporter import TemplateExporter | |
|
19 | 19 | |
|
20 | 20 | #----------------------------------------------------------------------------- |
|
21 | 21 | # Classes |
|
22 | 22 | #----------------------------------------------------------------------------- |
|
23 | 23 | |
|
24 | class PythonExporter(Exporter): | |
|
24 | class PythonExporter(TemplateExporter): | |
|
25 | 25 | """ |
|
26 | 26 | Exports a Python code file. |
|
27 | 27 | """ |
@@ -16,13 +16,13 b' Exporter for exporting notebooks to restructured text.' | |||
|
16 | 16 | from IPython.utils.traitlets import Unicode |
|
17 | 17 | from IPython.config import Config |
|
18 | 18 | |
|
19 | from .exporter import Exporter | |
|
19 | from .exporter import TemplateExporter | |
|
20 | 20 | |
|
21 | 21 | #----------------------------------------------------------------------------- |
|
22 | 22 | # Classes |
|
23 | 23 | #----------------------------------------------------------------------------- |
|
24 | 24 | |
|
25 | class RSTExporter(Exporter): | |
|
25 | class RSTExporter(TemplateExporter): | |
|
26 | 26 | """ |
|
27 | 27 | Exports restructured text documents. |
|
28 | 28 | """ |
@@ -19,13 +19,13 b' from IPython.utils.traitlets import Unicode' | |||
|
19 | 19 | from IPython.nbconvert import preprocessors |
|
20 | 20 | from IPython.config import Config |
|
21 | 21 | |
|
22 | from .exporter import Exporter | |
|
22 | from .exporter import TemplateExporter | |
|
23 | 23 | |
|
24 | 24 | #----------------------------------------------------------------------------- |
|
25 | 25 | # Classes |
|
26 | 26 | #----------------------------------------------------------------------------- |
|
27 | 27 | |
|
28 | class SlidesExporter(Exporter): | |
|
28 | class SlidesExporter(TemplateExporter): | |
|
29 | 29 | """ |
|
30 | 30 | Exports slides |
|
31 | 31 | """ |
@@ -27,4 +27,4 b' class ExportersTestsBase(TestsBase):' | |||
|
27 | 27 | |
|
28 | 28 | def _get_notebook(self): |
|
29 | 29 | return os.path.join(self._get_files_path(), 'notebook2.ipynb') |
|
30 | No newline at end of file | |
|
30 |
@@ -99,4 +99,4 b' class TestExport(ExportersTestsBase):' | |||
|
99 | 99 | (output, resources) = export(None, self._get_notebook()) |
|
100 | 100 | except TypeError: |
|
101 | 101 | pass |
|
102 | No newline at end of file | |
|
102 |
@@ -59,7 +59,7 b' nbconvert_aliases = {}' | |||
|
59 | 59 | nbconvert_aliases.update(base_aliases) |
|
60 | 60 | nbconvert_aliases.update({ |
|
61 | 61 | 'to' : 'NbConvertApp.export_format', |
|
62 | 'template' : 'Exporter.template_file', | |
|
62 | 'template' : 'TemplateExporter.template_file', | |
|
63 | 63 | 'writer' : 'NbConvertApp.writer_class', |
|
64 | 64 | 'post': 'NbConvertApp.postprocessor_class', |
|
65 | 65 | 'output': 'NbConvertApp.output_base', |
General Comments 0
You need to be logged in to leave comments.
Login now