Show More
@@ -46,13 +46,11 b' class ResourcesDict(collections.defaultdict):' | |||||
46 |
|
46 | |||
47 | class Exporter(LoggingConfigurable): |
|
47 | class Exporter(LoggingConfigurable): | |
48 | """ |
|
48 | """ | |
49 | Exporter class that only converts from notebook to notebook |
|
49 | Class containing methods that sequentially run a list of preprocessors on a | |
50 | by applying the preprocessors and providing basic methods for |
|
50 | NotebookNode object and then return the modified NotebookNode object and | |
51 | reading a notebook from different sources. |
|
51 | accompanying resources dict. | |
52 | """ |
|
52 | """ | |
53 |
|
53 | |||
54 | # finish the docstring |
|
|||
55 |
|
||||
56 | file_extension = Unicode( |
|
54 | file_extension = Unicode( | |
57 | 'txt', config=True, |
|
55 | 'txt', config=True, | |
58 | help="Extension of the file that should be written to disk" |
|
56 | help="Extension of the file that should be written to disk" | |
@@ -108,7 +106,7 b' class Exporter(LoggingConfigurable):' | |||||
108 | super(Exporter, self)._config_changed(name, old, c) |
|
106 | super(Exporter, self)._config_changed(name, old, c) | |
109 |
|
107 | |||
110 |
|
108 | |||
111 | def from_notebook_node(self, nb, resources=None): |
|
109 | def from_notebook_node(self, nb, resources=None, **kw): | |
112 | """ |
|
110 | """ | |
113 | Convert a notebook from a notebook node instance. |
|
111 | Convert a notebook from a notebook node instance. | |
114 |
|
112 | |||
@@ -123,7 +121,7 b' class Exporter(LoggingConfigurable):' | |||||
123 | resources = self._init_resources(resources) |
|
121 | resources = self._init_resources(resources) | |
124 |
|
122 | |||
125 | # Preprocess |
|
123 | # Preprocess | |
126 |
nb_copy, resources = self._ |
|
124 | nb_copy, resources = self._preprocess(nb_copy, resources) | |
127 |
|
125 | |||
128 | return nb_copy, resources |
|
126 | return nb_copy, resources | |
129 |
|
127 | |||
@@ -169,7 +167,7 b' class Exporter(LoggingConfigurable):' | |||||
169 | def register_preprocessor(self, preprocessor, enabled=False): |
|
167 | def register_preprocessor(self, preprocessor, enabled=False): | |
170 | """ |
|
168 | """ | |
171 | Register a preprocessor. |
|
169 | Register a preprocessor. | |
172 |
|
|
170 | Preprocessors are classes that act upon the notebook before it is | |
173 | passed into the Jinja templating engine. preprocessors are also |
|
171 | passed into the Jinja templating engine. preprocessors are also | |
174 | capable of passing additional information to the Jinja |
|
172 | capable of passing additional information to the Jinja | |
175 | templating engine. |
|
173 | templating engine. | |
@@ -256,7 +254,7 b' class Exporter(LoggingConfigurable):' | |||||
256 | return resources |
|
254 | return resources | |
257 |
|
255 | |||
258 |
|
256 | |||
259 |
def _ |
|
257 | def _preprocess(self, nb, resources): | |
260 | """ |
|
258 | """ | |
261 | Preprocess the notebook before passing it into the Jinja engine. |
|
259 | Preprocess the notebook before passing it into the Jinja engine. | |
262 | To preprocess the notebook is to apply all of the |
|
260 | To preprocess the notebook is to apply all of the |
General Comments 0
You need to be logged in to leave comments.
Login now