Show More
@@ -42,6 +42,33 b' class ConverterReveal(ConverterMarkdown):' | |||
|
42 | 42 | return [self.meta2str(cell.metadata), |
|
43 | 43 | '{0} {1}'.format('#' * cell.level, cell.source), ''] |
|
44 | 44 | |
|
45 | def render_code(self, cell): | |
|
46 | if not cell.input: | |
|
47 | return [] | |
|
48 | lines = [] | |
|
49 | meta_code = self.meta2str(cell.metadata) | |
|
50 | lines.extend([meta_code]) | |
|
51 | lines.extend(['<!-- hack -->']) # to be proper parsed | |
|
52 | n = self._get_prompt_number(cell) | |
|
53 | if self.show_prompts and not self.inline_prompt: | |
|
54 | lines.extend(['*In[%s]:*' % n, '']) | |
|
55 | if self.show_prompts and self.inline_prompt: | |
|
56 | prompt = 'In[%s]: ' % n | |
|
57 | input_lines = cell.input.split('\n') | |
|
58 | src = (prompt + input_lines[0] + '\n' + | |
|
59 | indent('\n'.join(input_lines[1:]), nspaces=len(prompt))) | |
|
60 | else: | |
|
61 | src = cell.input | |
|
62 | src = highlight(src) if self.highlight_source else indent(src) | |
|
63 | lines.extend([src, '']) | |
|
64 | if cell.outputs and self.show_prompts and not self.inline_prompt: | |
|
65 | lines.extend(['*Out[%s]:*' % n, '']) | |
|
66 | for output in cell.outputs: | |
|
67 | conv_fn = self.dispatch(output.output_type) | |
|
68 | lines.extend(conv_fn(output)) | |
|
69 | #lines.append('') | |
|
70 | return lines | |
|
71 | ||
|
45 | 72 | def render_markdown(self, cell): |
|
46 | 73 | return [self.meta2str(cell.metadata), cell.source, ''] |
|
47 | 74 |
General Comments 0
You need to be logged in to leave comments.
Login now