##// END OF EJS Templates
allow to pass a resource dict with notebook...
Matthias BUSSONNIER -
Show More
@@ -141,16 +141,20 b' class Exporter(Configurable):'
141 141 self.environment.filters[key] = user_filter
142 142
143 143
144 def from_notebook_node(self, nb):
144 def from_notebook_node(self, nb, resources=None):
145 145 """
146 146 Convert a notebook from a notebook node instance.
147 147
148 148 Parameters
149 149 ----------
150 150 nb : Notebook node
151 resources : a dict of additional resources that
152 can be accessed read/write by transformers
153 and filters.
151 154 """
152
153 nb, resources = self._preprocess(nb)
155 if resources is None:
156 resources = {}
157 nb, resources = self._preprocess(nb, resources)
154 158
155 159 #Load the template file.
156 160 self.template = self.environment.get_template(self.template_file+self.template_extension)
@@ -296,7 +300,7 b' class Exporter(Configurable):'
296 300 self.environment.comment_end_string = self.jinja_comment_block_end
297 301
298 302
299 def _preprocess(self, nb):
303 def _preprocess(self, nb, resources):
300 304 """
301 305 Preprocess the notebook before passing it into the Jinja engine.
302 306 To preprocess the notebook is to apply all of the
@@ -305,10 +309,11 b' class Exporter(Configurable):'
305 309 ----------
306 310 nb : notebook node
307 311 notebook that is being exported.
312 resources : a dict of additional resources that
313 can be accessed read/write by transformers
314 and filters.
308 315 """
309 316
310 #Dict of 'resources' that can be filled by the transformers.
311 resources = {}
312 317
313 318 #Run each transformer on the notebook. Carry the output along
314 319 #to each transformer
General Comments 0
You need to be logged in to leave comments. Login now