Show More
@@ -40,7 +40,7 b' from IPython.utils.traitlets import (List, Unicode, Type, Bool, Dict, CaselessSt' | |||
|
40 | 40 | from IPython.utils.text import indent |
|
41 | 41 | from .utils import remove_ansi |
|
42 | 42 | from markdown import markdown |
|
43 | from .utils import highlight | |
|
43 | from .utils import highlight,ansi2html | |
|
44 | 44 | #----------------------------------------------------------------------------- |
|
45 | 45 | # Class declarations |
|
46 | 46 | #----------------------------------------------------------------------------- |
@@ -60,6 +60,7 b" env.filters['rm_fake'] = rm_fake" | |||
|
60 | 60 | env.filters['rm_ansi'] = remove_ansi |
|
61 | 61 | env.filters['markdown'] = markdown |
|
62 | 62 | env.filters['highlight'] = highlight |
|
63 | env.filters['ansi2html'] = ansi2html | |
|
63 | 64 | |
|
64 | 65 | class ConverterTemplate(Configurable): |
|
65 | 66 | |
@@ -87,6 +88,11 b' class ConverterTemplate(Configurable):' | |||
|
87 | 88 | for worksheet in self.nb.worksheets: |
|
88 | 89 | for cell in worksheet.cells: |
|
89 | 90 | cell.type = cell.cell_type |
|
91 | cell.haspyout = False | |
|
92 | for out in cell.get('outputs',[]): | |
|
93 | if out.output_type == 'pyout': | |
|
94 | cell.haspyout = True | |
|
95 | break | |
|
90 | 96 | converted_cells.append(worksheet) |
|
91 | 97 | |
|
92 | 98 | return converted_cells |
@@ -30,8 +30,7 b'' | |||
|
30 | 30 | |
|
31 | 31 | {% block output_prompt -%} |
|
32 | 32 | <div class="prompt output_prompt"> |
|
33 | {%- if cell.prompt_number is not none -%} | |
|
34 | {#- check the case of Out[#]-#} | |
|
33 | {%- if cell.haspyout -%} | |
|
35 | 34 | Out[{{cell.prompt_number}}]: |
|
36 | 35 | {%- endif -%} |
|
37 | 36 | </div> |
@@ -59,7 +58,7 b' Out[{{cell.prompt_number}}]:' | |||
|
59 | 58 | {% endblock headingcell %} |
|
60 | 59 | |
|
61 | 60 | {% block rawcell scoped %} |
|
62 |
{{ cell.source |
|
|
61 | {{ cell.source }} | |
|
63 | 62 | {% endblock rawcell %} |
|
64 | 63 | |
|
65 | 64 | {% block unknowncell scoped %} |
@@ -69,12 +68,29 b' unknown type {{cell.type}}' | |||
|
69 | 68 | |
|
70 | 69 | {% block pyout -%} |
|
71 | 70 | <div class="output_subarea output_pyout"> |
|
72 | <pre>{{output.text}}</pre> | |
|
71 | <pre>{{output.text | ansi2html}}</pre> | |
|
73 | 72 | </div> |
|
74 | 73 | {%- endblock pyout %} |
|
75 | 74 | |
|
76 | 75 | {% block stream -%} |
|
77 | 76 | <div class="output_subarea output_stream output_stdout"> |
|
78 | <pre>{{output.text}}</pre> | |
|
77 | <pre>{{output.text |ansi2html}}</pre> | |
|
79 | 78 | </div> |
|
80 | 79 | {%- endblock stream %} |
|
80 | ||
|
81 | {% block display_data -%} | |
|
82 | <div class="output_subarea output_display_data"> | |
|
83 | {{output.svg}} | |
|
84 | </div> | |
|
85 | {%- endblock display_data %} | |
|
86 | ||
|
87 | ||
|
88 | {% block pyerr -%} | |
|
89 | <div class="output_subarea output_pyerr"> | |
|
90 | <pre>{{super()}}</pre> | |
|
91 | </div> | |
|
92 | {%- endblock pyerr %} | |
|
93 | ||
|
94 | {%- block traceback_line %} | |
|
95 | {{line| ansi2html}} | |
|
96 | {%- endblock traceback_line %} |
@@ -771,9 +771,9 b' init_mathjax();' | |||
|
771 | 771 | |
|
772 | 772 | |
|
773 | 773 | {% block body %} |
|
774 |
<body>{{ super() }} |
|
|
775 | ||
|
776 | {% endblock body %} | |
|
774 | <body>{{ super() }} | |
|
775 | </body> | |
|
776 | {%- endblock body %} | |
|
777 | 777 | |
|
778 | 778 | |
|
779 | 779 | |
@@ -783,5 +783,4 b' init_mathjax();' | |||
|
783 | 783 | |
|
784 | 784 | |
|
785 | 785 | {% block footer %} |
|
786 | </html> | |
|
787 | {% endblock footer %} | |
|
786 | </html>{% endblock footer %} |
General Comments 0
You need to be logged in to leave comments.
Login now