Show More
@@ -97,6 +97,6 b' class ConverterTemplate(Configurable):' | |||||
97 |
|
97 | |||
98 | def read(self, filename): |
|
98 | def read(self, filename): | |
99 | "read and parse notebook into NotebookNode called self.nb" |
|
99 | "read and parse notebook into NotebookNode called self.nb" | |
100 | with open(filename) as f: |
|
100 | with io.open(filename) as f: | |
101 | self.nb = nbformat.read(f, 'json') |
|
101 | self.nb = nbformat.read(f, 'json') | |
102 |
|
102 |
@@ -1,9 +1,10 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
2 | # coding: utf-8 |
|
2 | # coding: utf-8 | |
|
3 | from __future__ import print_function | |||
3 | import sys |
|
4 | import sys | |
4 | import io |
|
5 | import io | |
5 | from converters.template import * |
|
6 | from converters.template import * | |
6 | C = ConverterTemplate(tplfile=sys.argv[1]) |
|
7 | C = ConverterTemplate(tplfile=sys.argv[1]) | |
7 | C.read('tests/ipynbref/IntroNumPy.orig.ipynb') |
|
8 | C.read('tests/ipynbref/IntroNumPy.orig.ipynb') | |
8 |
|
9 | |||
9 |
print |
|
10 | print(C.convert().encode('utf-8')) |
@@ -1,27 +1,43 b'' | |||||
1 | {%- extends 'null.tpl' -%} |
|
1 | {%- extends 'null.tpl' -%} | |
2 |
|
2 | |||
3 | {% block in_prompt %} |
|
3 | {% block in_prompt %} | |
4 |
# In[{{cell.prompt_number if cell.prompt_number else ' '}}]: |
|
4 | # In[{{cell.prompt_number if cell.prompt_number else ' '}}]: | |
|
5 | {% endblock in_prompt %} | |||
|
6 | ||||
|
7 | {% block output_prompt %} | |||
|
8 | # Out[{{cell.prompt_number}}]:{% endblock output_prompt %} | |||
|
9 | ||||
|
10 | {% block input %}{{ cell.input }} | |||
|
11 | {% endblock input %} | |||
|
12 | ||||
|
13 | ||||
|
14 | {# Those Two are for error displaying | |||
|
15 | even if the first one seem to do nothing, | |||
|
16 | it introduces a new line | |||
|
17 | ||||
|
18 | #} | |||
|
19 | {% block pyerr %}{{ super() }} | |||
|
20 | {% endblock pyerr %} | |||
5 |
|
21 | |||
6 | {% block traceback_line %} |
|
22 | {% block traceback_line %} | |
7 | {{ line |indent| rm_ansi }} |
|
23 | {{ line |indent| rm_ansi }}{% endblock traceback_line %} | |
8 | {% endblock traceback_line %} |
|
24 | {# .... #} | |
9 |
|
25 | |||
10 |
|
26 | |||
11 | {% block pyout %} |
|
27 | {% block pyout %} | |
12 |
{{ output.text| indent | pycomment}} |
|
28 | {{ output.text| indent | pycomment}} | |
|
29 | {% endblock pyout %} | |||
13 |
|
30 | |||
14 | {% block stream %} |
|
31 | {% block stream %} | |
15 | {{ output.text| indent | pycomment}} |
|
32 | {{ output.text| indent | pycomment}} | |
16 | {% endblock stream %} |
|
33 | {% endblock stream %} | |
17 |
|
34 | |||
18 | {% block output_prompt %}# Out[{{cell.prompt_number}}]:{% endblock output_prompt %} |
|
|||
19 |
|
35 | |||
20 |
|
36 | |||
21 | {% block input %}{{ cell.input }}{% endblock input %} |
|
|||
22 |
|
37 | |||
23 | {% block display_data scoped %} |
|
38 | {% block display_data scoped %} | |
24 | # image file:{% endblock display_data %} |
|
39 | # image file: | |
|
40 | {% endblock display_data %} | |||
25 |
|
41 | |||
26 | {% block markdowncell scoped %} |
|
42 | {% block markdowncell scoped %} | |
27 | {{ cell.source | pycomment }} |
|
43 | {{ cell.source | pycomment }} |
General Comments 0
You need to be logged in to leave comments.
Login now