##// END OF EJS Templates
improve rst_directive and fix bug in unknown_cell
Fernando Perez -
Show More
@@ -24,8 +24,8 b' def unknown_cell(cell):'
24 24 """Default converter for cells of unknown type.
25 25 """
26 26
27 return [rst_directive('.. warning:: Unknown cell'),
28 repr(cell)]
27 return rst_directive('.. warning:: Unknown cell') + \
28 [repr(cell)]
29 29
30 30 def markdown_cell(cell):
31 31 """convert a markdown cell to rst
@@ -34,8 +34,11 b' def markdown_cell(cell):'
34 34 return [cell.source]
35 35
36 36
37 def rst_directive(directive, text):
38 return [directive, '', indent(text), '']
37 def rst_directive(directive, text=''):
38 out = [directive, '']
39 if text:
40 out.extend([indent(text), ''])
41 return out
39 42
40 43 def code_cell(cell):
41 44 """Convert a code cell to rst
@@ -49,7 +52,7 b' def code_cell(cell):'
49 52 lines.extend(rst_directive('.. code:: python', cell.input))
50 53
51 54 for output in cell.outputs:
52 conv = converters[output.output_type]
55 conv = converters.get(output.output_type, unknown_cell)
53 56 lines.extend(conv(output))
54 57
55 58 return lines
General Comments 0
You need to be logged in to leave comments. Login now