Show More
@@ -0,0 +1,14 b'' | |||||
|
1 | """Generic script exporter class for any kernel language""" | |||
|
2 | ||||
|
3 | from .templateexporter import TemplateExporter | |||
|
4 | ||||
|
5 | class ScriptExporter(TemplateExporter): | |||
|
6 | def _template_file_default(self): | |||
|
7 | return 'script' | |||
|
8 | ||||
|
9 | def from_notebook_node(self, nb, resources=None, **kw): | |||
|
10 | langinfo = nb.metadata.get('language_info', {}) | |||
|
11 | self.file_extension = langinfo.get('file_extension', 'txt') | |||
|
12 | self.output_mimetype = langinfo.get('mimetype', 'text/plain') | |||
|
13 | ||||
|
14 | return super(ScriptExporter, self).from_notebook_node(nb, resources, **kw) |
@@ -0,0 +1,5 b'' | |||||
|
1 | {%- extends 'null.tpl' -%} | |||
|
2 | ||||
|
3 | {% block input %} | |||
|
4 | {{ cell.source }} | |||
|
5 | {% endblock input %} |
@@ -19,6 +19,7 b' from .markdown import MarkdownExporter' | |||||
19 | from .python import PythonExporter |
|
19 | from .python import PythonExporter | |
20 | from .rst import RSTExporter |
|
20 | from .rst import RSTExporter | |
21 | from .notebook import NotebookExporter |
|
21 | from .notebook import NotebookExporter | |
|
22 | from .script import ScriptExporter | |||
22 |
|
23 | |||
23 | #----------------------------------------------------------------------------- |
|
24 | #----------------------------------------------------------------------------- | |
24 | # Classes |
|
25 | # Classes | |
@@ -74,6 +75,7 b' __all__ = [' | |||||
74 | 'export_pdf', |
|
75 | 'export_pdf', | |
75 | 'export_markdown', |
|
76 | 'export_markdown', | |
76 | 'export_python', |
|
77 | 'export_python', | |
|
78 | 'export_script', | |||
77 | 'export_rst', |
|
79 | 'export_rst', | |
78 | 'export_by_name', |
|
80 | 'export_by_name', | |
79 | 'get_export_names', |
|
81 | 'get_export_names', | |
@@ -132,6 +134,7 b' exporter_map = dict(' | |||||
132 | python=PythonExporter, |
|
134 | python=PythonExporter, | |
133 | rst=RSTExporter, |
|
135 | rst=RSTExporter, | |
134 | notebook=NotebookExporter, |
|
136 | notebook=NotebookExporter, | |
|
137 | script=ScriptExporter, | |||
135 | ) |
|
138 | ) | |
136 |
|
139 | |||
137 | def _make_exporter(name, E): |
|
140 | def _make_exporter(name, E): |
General Comments 0
You need to be logged in to leave comments.
Login now