##// END OF EJS Templates
Removed "profiles"... Templates that are shipped with nbconvert by default should...
Removed "profiles"... Templates that are shipped with nbconvert by default should have settings built into exporter.py class. If the user wants to add a new template and use profile setting with it, the "profile" (config file) should be specified via the commandline when calling the exporter.

File last commit:

r10386:6416b524
r10435:896aaed3
Show More
custom_converter.py
27 lines | 752 B | text/x-python | PythonLexer
Jonathan Taylor
simple custom converter
r7367 """
Paul Ivanov
fixed typo
r8608 This module gives a simple example of a custom notebook converter that only
captures display data and deletes the cell inputs.
Jonathan Taylor
simple custom converter
r7367 """
Jonathan Taylor
overriding DocInherit due to recursion depth errors
r7366
Jonathan Taylor
simple custom converter
r7367 import copy
Jonathan Taylor
overriding DocInherit due to recursion depth errors
r7366 import nbconvert as nb
David Warde-Farley
PEP8-ify rest of the repository.
r8749
Jonathan Taylor
overriding DocInherit due to recursion depth errors
r7366 class CustomNotebookConverter(nb.ConverterNotebook):
def render_code(self, cell):
captured_outputs = ['text', 'html', 'svg', 'latex', 'javascript']
cell = copy.deepcopy(cell)
cell['input'] = ''
for output in cell.outputs:
if output.output_type != 'display_data':
cell.outputs.remove(output)
return nb.ConverterNotebook.render_code(self, cell)
if __name__ == '__main__':
infile = 'tests/test_display.ipynb'
converter = CustomNotebookConverter(infile, 'test_only_display')
converter.render()