Show More
@@ -195,6 +195,9 b' def markdown2rst(src):' | |||||
195 |
|
195 | |||
196 |
|
196 | |||
197 | def rst_directive(directive, text=''): |
|
197 | def rst_directive(directive, text=''): | |
|
198 | """ | |||
|
199 | Makes ReST directive block and indents any text passed to it. | |||
|
200 | """ | |||
198 | out = [directive, ''] |
|
201 | out = [directive, ''] | |
199 | if text: |
|
202 | if text: | |
200 | out.extend([indent(text), '']) |
|
203 | out.extend([indent(text), '']) | |
@@ -270,6 +273,22 b' class Converter(object):' | |||||
270 | return getattr(self, 'render_display_format_' + format, self.render_unknown_display) |
|
273 | return getattr(self, 'render_display_format_' + format, self.render_unknown_display) | |
271 |
|
274 | |||
272 | def convert(self, cell_separator='\n'): |
|
275 | def convert(self, cell_separator='\n'): | |
|
276 | """ | |||
|
277 | Generic method to converts notebook to a string representation. | |||
|
278 | ||||
|
279 | This is accomplished by dispatching on the cell_type, so subclasses of | |||
|
280 | Convereter class do not need to re-implement this method, but just | |||
|
281 | need implementation for the methods that will be dispatched. | |||
|
282 | ||||
|
283 | Parameters | |||
|
284 | ---------- | |||
|
285 | cell_separator : string | |||
|
286 | Character or string to join cells with. Default is "\n" | |||
|
287 | ||||
|
288 | Returns | |||
|
289 | ------- | |||
|
290 | out : string | |||
|
291 | """ | |||
273 | lines = [] |
|
292 | lines = [] | |
274 | lines.extend(self.optional_header()) |
|
293 | lines.extend(self.optional_header()) | |
275 | converted_cells = [] |
|
294 | converted_cells = [] | |
@@ -308,9 +327,19 b' class Converter(object):' | |||||
308 | return os.path.abspath(outfile) |
|
327 | return os.path.abspath(outfile) | |
309 |
|
328 | |||
310 | def optional_header(self): |
|
329 | def optional_header(self): | |
|
330 | """ | |||
|
331 | Optional header to insert at the top of the converted notebook | |||
|
332 | ||||
|
333 | Returns a list | |||
|
334 | """ | |||
311 | return [] |
|
335 | return [] | |
312 |
|
336 | |||
313 | def optional_footer(self): |
|
337 | def optional_footer(self): | |
|
338 | """ | |||
|
339 | Optional footer to insert at the end of the converted notebook | |||
|
340 | ||||
|
341 | Returns a list | |||
|
342 | """ | |||
314 | return [] |
|
343 | return [] | |
315 |
|
344 | |||
316 | def _new_figure(self, data, fmt): |
|
345 | def _new_figure(self, data, fmt): |
General Comments 0
You need to be logged in to leave comments.
Login now