Show More
@@ -96,7 +96,6 b' class DocStringInheritor(type):' | |||||
96 | return type.__new__(meta, classname, bases, newClassDict) |
|
96 | return type.__new__(meta, classname, bases, newClassDict) | |
97 |
|
97 | |||
98 |
|
98 | |||
99 |
|
||||
100 | class Converter(Configurable): |
|
99 | class Converter(Configurable): | |
101 | #__metaclass__ = DocStringInheritor |
|
100 | #__metaclass__ = DocStringInheritor | |
102 | #------------------------------------------------------------------------- |
|
101 | #------------------------------------------------------------------------- | |
@@ -122,6 +121,10 b' class Converter(Configurable):' | |||||
122 | preamble = Unicode("" , |
|
121 | preamble = Unicode("" , | |
123 | config=True, |
|
122 | config=True, | |
124 | help="Path to a user-specified preamble file") |
|
123 | help="Path to a user-specified preamble file") | |
|
124 | extract_figures = Bool( True, | |||
|
125 | config=True, | |||
|
126 | help="""extract base-64 encoded figures of the notebook into separate files, | |||
|
127 | replace by link to corresponding file in source.""") | |||
125 |
|
128 | |||
126 | infile_dir = Unicode() |
|
129 | infile_dir = Unicode() | |
127 | infile_root = Unicode() |
|
130 | infile_root = Unicode() | |
@@ -320,7 +323,8 b' class Converter(Configurable):' | |||||
320 | raise RuntimeError('no display data') |
|
323 | raise RuntimeError('no display data') | |
321 |
|
324 | |||
322 | # Is it an image? |
|
325 | # Is it an image? | |
323 | if fmt in ['png', 'svg', 'jpg', 'pdf']: |
|
326 | if fmt in ['png', 'svg', 'jpg', 'pdf'] and self.extract_figures: | |
|
327 | print('I will extract this', fmt) | |||
324 | img_file = self._new_figure(output[fmt], fmt) |
|
328 | img_file = self._new_figure(output[fmt], fmt) | |
325 | # Subclasses can have format-specific render functions (e.g., |
|
329 | # Subclasses can have format-specific render functions (e.g., | |
326 | # latex has to auto-convert all SVG to PDF first). |
|
330 | # latex has to auto-convert all SVG to PDF first). | |
@@ -329,6 +333,7 b' class Converter(Configurable):' | |||||
329 | lines_fun = self._img_lines |
|
333 | lines_fun = self._img_lines | |
330 | lines = lines_fun(img_file) |
|
334 | lines = lines_fun(img_file) | |
331 | else: |
|
335 | else: | |
|
336 | print('I will NOT extract this', fmt) | |||
332 | lines_fun = self.dispatch_display_format(fmt) |
|
337 | lines_fun = self.dispatch_display_format(fmt) | |
333 | lines = lines_fun(output) |
|
338 | lines = lines_fun(output) | |
334 |
|
339 |
@@ -64,7 +64,6 b' class NbconvertApp(Application):' | |||||
64 | config=True, |
|
64 | config=True, | |
65 | help = 'list of cells to exclude while converting') |
|
65 | help = 'list of cells to exclude while converting') | |
66 |
|
66 | |||
67 | infile = Unicode("", config=True) |
|
|||
68 |
|
67 | |||
69 | converter = ConverterClass(infile, highlight_source=highlight_source, exclude=exclude) |
|
68 | converter = ConverterClass(infile, highlight_source=highlight_source, exclude=exclude) | |
70 | converter.render() |
|
69 | converter.render() | |
@@ -74,7 +73,6 b' class NbconvertApp(Application):' | |||||
74 | 'format':'NbconvertApp.fmt', |
|
73 | 'format':'NbconvertApp.fmt', | |
75 | 'highlight':'Converter.highlight_source', |
|
74 | 'highlight':'Converter.highlight_source', | |
76 | 'preamble':'Converter.preamble', |
|
75 | 'preamble':'Converter.preamble', | |
77 | 'infile' : 'NbconvertApp.infile' |
|
|||
78 | } |
|
76 | } | |
79 |
|
77 | |||
80 | def __init__(self, **kwargs): |
|
78 | def __init__(self, **kwargs): |
General Comments 0
You need to be logged in to leave comments.
Login now