Show More
@@ -116,14 +116,27 b' class ConverterTemplate(Configurable):' | |||
|
116 | 116 | |
|
117 | 117 | infile_dir = Unicode() |
|
118 | 118 | |
|
119 | def __init__(self, tplfile='fullhtml', config=None, **kw): | |
|
119 | def __init__(self, tplfile='fullhtml', preprocessors=[], config=None, **kw): | |
|
120 | """ | |
|
121 | preprocessors: list of function to run on ipynb json data before conversion | |
|
122 | to extract/inline file, | |
|
123 | ||
|
124 | ||
|
125 | ||
|
126 | """ | |
|
120 | 127 | self.template = env.get_template(tplfile+'.tpl') |
|
121 | 128 | self.nb = None |
|
129 | self.preprocessors = preprocessors | |
|
122 | 130 | super(ConverterTemplate, self).__init__(config=config, **kw) |
|
123 | 131 | |
|
124 | 132 | def process(self): |
|
125 | converted_cells = [] | |
|
126 | for worksheet in self.nb.worksheets: | |
|
133 | nb = self.nb | |
|
134 | ||
|
135 | for preprocessor in self.preprocessors: | |
|
136 | nb = preprocessor(nb,{}) | |
|
137 | ||
|
138 | worksheets = [] | |
|
139 | for worksheet in nb.worksheets: | |
|
127 | 140 | for cell in worksheet.cells: |
|
128 | 141 | cell.type = cell.cell_type |
|
129 | 142 | cell.haspyout = False |
@@ -131,9 +144,10 b' class ConverterTemplate(Configurable):' | |||
|
131 | 144 | if out.output_type == 'pyout': |
|
132 | 145 | cell.haspyout = True |
|
133 | 146 | break |
|
134 |
|
|
|
147 | worksheets.append(worksheet) | |
|
148 | ||
|
135 | 149 | |
|
136 |
return |
|
|
150 | return worksheets | |
|
137 | 151 | |
|
138 | 152 | def convert(self): |
|
139 | 153 | """ convert the ipynb file |
General Comments 0
You need to be logged in to leave comments.
Login now