##// END OF EJS Templates
Added exclusion code for rst, markdown, and html.
kevin -
Show More
@@ -127,19 +127,20 b' class ConverterHTML(Converter):'
127 return []
127 return []
128
128
129 lines = ['<div class="cell border-box-sizing code_cell vbox">']
129 lines = ['<div class="cell border-box-sizing code_cell vbox">']
130
130 if 'source' not in self.exclude_cells:
131 lines.append('<div class="input hbox">')
131
132 n = self._get_prompt_number(cell)
132 lines.append('<div class="input hbox">')
133 lines.append(
133 n = self._get_prompt_number(cell)
134 '<div class="prompt input_prompt">In&nbsp;[%s]:</div>' % n
134 lines.append(
135 )
135 '<div class="prompt input_prompt">In&nbsp;[%s]:</div>' % n
136 lines.append('<div class="input_area box-flex1">')
136 )
137 lines.append(highlight(cell.input) if self.highlight_source
137 lines.append('<div class="input_area box-flex1">')
138 else cell.input)
138 lines.append(highlight(cell.input) if self.highlight_source
139 lines.append('</div>') # input_area
139 else cell.input)
140 lines.append('</div>') # input
140 lines.append('</div>') # input_area
141
141 lines.append('</div>') # input
142 if cell.outputs:
142
143 if cell.outputs and 'output' not in self.exclude_cells:
143 lines.append('<div class="vbox output_wrapper">')
144 lines.append('<div class="vbox output_wrapper">')
144 lines.append('<div class="output vbox">')
145 lines.append('<div class="output vbox">')
145
146
@@ -154,6 +155,7 b' class ConverterHTML(Converter):'
154
155
155 return lines
156 return lines
156
157
158
157 @text_cell
159 @text_cell
158 def render_markdown(self, cell):
160 def render_markdown(self, cell):
159 return [markdown(cell.source)]
161 return [markdown(cell.source)]
@@ -54,24 +54,28 b' class ConverterMarkdown(Converter):'
54 if not cell.input:
54 if not cell.input:
55 return []
55 return []
56 lines = []
56 lines = []
57 n = self._get_prompt_number(cell)
57
58 if self.show_prompts:
58 if 'source' not in self.exclude_cells:
59 if not self.inline_prompt:
59 n = self._get_prompt_number(cell)
60 lines.extend(['*In[%s]:*' % n, ''])
60 if self.show_prompts:
61 if not self.inline_prompt:
62 lines.extend(['*In[%s]:*' % n, ''])
63 else:
64 prompt = 'In[%s]: ' % n
65 input_lines = cell.input.split('\n')
66 src = (prompt + input_lines[0] + '\n' +
67 indent('\n'.join(input_lines[1:]), nspaces=len(prompt)))
61 else:
68 else:
62 prompt = 'In[%s]: ' % n
69 src = cell.input
63 input_lines = cell.input.split('\n')
70 src = highlight(src) if self.highlight_source else indent(src)
64 src = (prompt + input_lines[0] + '\n' +
71 lines.extend([src, ''])
65 indent('\n'.join(input_lines[1:]), nspaces=len(prompt)))
72
66 else:
73 if 'output' not in self.exclude_cells:
67 src = cell.input
74 if cell.outputs and self.show_prompts and not self.inline_prompt:
68 src = highlight(src) if self.highlight_source else indent(src)
75 lines.extend(['*Out[%s]:*' % n, ''])
69 lines.extend([src, ''])
76 for output in cell.outputs:
70 if cell.outputs and self.show_prompts and not self.inline_prompt:
77 conv_fn = self.dispatch(output.output_type)
71 lines.extend(['*Out[%s]:*' % n, ''])
78 lines.extend(conv_fn(output))
72 for output in cell.outputs:
73 conv_fn = self.dispatch(output.output_type)
74 lines.extend(conv_fn(output))
75
79
76 #lines.append('----')
80 #lines.append('----')
77 lines.append('')
81 lines.append('')
@@ -43,12 +43,15 b' class ConverterRST(Converter):'
43 if not cell.input:
43 if not cell.input:
44 return []
44 return []
45
45
46 lines = ['In[%s]:' % self._get_prompt_number(cell), '']
46 lines = []
47 lines.extend(rst_directive('.. code:: python', cell.input))
47 if 'source' not in self.exclude_cells:
48
48 lines.extend(['In[%s]:' % self._get_prompt_number(cell), ''])
49 for output in cell.outputs:
49 lines.extend(rst_directive('.. code:: python', cell.input))
50 conv_fn = self.dispatch(output.output_type)
50
51 lines.extend(conv_fn(output))
51 if 'output' not in self.exclude_cells:
52 for output in cell.outputs:
53 conv_fn = self.dispatch(output.output_type)
54 lines.extend(conv_fn(output))
52
55
53 return lines
56 return lines
54
57
General Comments 0
You need to be logged in to leave comments. Login now