Show More
@@ -70,7 +70,7 b' class ConverterTemplate(Configurable):' | |||
|
70 | 70 | #------------------------------------------------------------------------- |
|
71 | 71 | infile = Any() |
|
72 | 72 | |
|
73 | ||
|
73 | ||
|
74 | 74 | infile_dir = Unicode() |
|
75 | 75 | |
|
76 | 76 | def __init__(self, tplfile='fullhtml', config=None, **kw): |
@@ -87,17 +87,12 b' class ConverterTemplate(Configurable):' | |||
|
87 | 87 | for worksheet in self.nb.worksheets: |
|
88 | 88 | for cell in worksheet.cells: |
|
89 | 89 | cell.type = cell.cell_type |
|
90 |
|
|
|
91 | continue | |
|
92 | if cell.cell_type in ('code'): | |
|
93 | converted_cells.append({'type':'code','source':cell.input}) | |
|
94 | else : | |
|
95 | converted_cells.append({'type':cell.cell_type,'source': python_comment(cell.source)}) | |
|
90 | converted_cells.append(worksheet) | |
|
96 | 91 | |
|
97 | 92 | return converted_cells |
|
98 | 93 | |
|
99 | 94 | def convert(self, cell_separator='\n'): |
|
100 |
return self.template.render( |
|
|
95 | return self.template.render(worksheets=self.process()) | |
|
101 | 96 | |
|
102 | 97 | |
|
103 | 98 | def read(self, filename): |
@@ -1,25 +1,27 b'' | |||
|
1 | 1 | {%- block header -%} |
|
2 | 2 | {%- endblock header -%} |
|
3 | 3 | {%- block body -%} |
|
4 |
{%- for |
|
|
5 |
{%- |
|
|
6 |
{%- |
|
|
7 |
{%- |
|
|
8 |
{%- |
|
|
9 | {%- elif cell.type in ['markdown'] -%} | |
|
10 |
{%- |
|
|
11 |
{%- |
|
|
12 | {%- elif cell.type in ['heading'] -%} | |
|
13 |
{%- |
|
|
14 |
{%- |
|
|
15 | {%- elif cell.type in ['raw'] -%} | |
|
16 |
{%- |
|
|
17 |
{%- |
|
|
18 |
{%- e |
|
|
19 |
{%- |
|
|
20 |
{%- |
|
|
21 | {%- endif -%} | |
|
22 | {%- endblock any_cell -%} | |
|
4 | {%- for worksheet in worksheets -%} | |
|
5 | {%- for cell in worksheet.cells -%} | |
|
6 | {%- block any_cell scoped -%} | |
|
7 | {%- if cell.type in ['code'] -%} | |
|
8 | {%- block codecell scoped-%} | |
|
9 | {%- endblock codecell-%} | |
|
10 | {%- elif cell.type in ['markdown'] -%} | |
|
11 | {%- block markdowncell scoped-%} | |
|
12 | {%- endblock markdowncell -%} | |
|
13 | {%- elif cell.type in ['heading'] -%} | |
|
14 | {%- block headingcell scoped-%} | |
|
15 | {%- endblock headingcell -%} | |
|
16 | {%- elif cell.type in ['raw'] -%} | |
|
17 | {%- block rawcell scoped-%} | |
|
18 | {%- endblock rawcell -%} | |
|
19 | {%- else -%} | |
|
20 | {%- block unknowncell scoped-%} | |
|
21 | {%- endblock unknowncell -%} | |
|
22 | {%- endif -%} | |
|
23 | {%- endblock any_cell -%} | |
|
24 | {%- endfor -%} | |
|
23 | 25 | {%- endfor -%} |
|
24 | 26 | {%- endblock body -%} |
|
25 | 27 |
@@ -40,12 +40,10 b' consider calling super even if block is leave block, we might insert more block ' | |||
|
40 | 40 | {% endblock pyerr %} |
|
41 | 41 | {%- endif %} |
|
42 | 42 | {%- endfor -%} |
|
43 | {% endif %} | |
|
43 | {% endif -%} | |
|
44 | {%- endblock codecell %} | |
|
44 | 45 | |
|
45 | {% endblock codecell %} | |
|
46 | ||
|
47 | {% block markdowncell scoped %} | |
|
48 | {% endblock markdowncell %} | |
|
46 | {% block markdowncell scoped %}{% endblock markdowncell %} | |
|
49 | 47 | |
|
50 | 48 | {% block headingcell scoped %} |
|
51 | 49 | {% endblock headingcell %} |
@@ -1,9 +1,31 b'' | |||
|
1 | 1 | {%- extends 'python.tpl' -%} |
|
2 | 2 | |
|
3 | {% block any_cell %} | |
|
3 | {#% block any_cell %} | |
|
4 | 4 | ============================== |
|
5 | 5 | =======start {{cell.type}}========= |
|
6 | 6 | {{ super() }} |
|
7 | 7 | ======= end {{cell.type}} ========= |
|
8 | =============================={% endblock any_cell %} | |
|
8 | =============================={% endblock any_cell %#} | |
|
9 | ||
|
10 | ||
|
11 | ||
|
12 | {% block markdowncell %}---- Start MD ----{{ super() }} | |
|
13 | ---- End MD ---- | |
|
14 | {% endblock markdowncell %} | |
|
15 | ||
|
16 | {% block codecell %}---- Start Code ----{{ super() }} | |
|
17 | ---- End Code ---- | |
|
18 | {% endblock codecell %} | |
|
19 | ||
|
20 | {% block headingcell scoped %}---- Start heading ----{{ super() }} | |
|
21 | ---- End heading ---- | |
|
22 | {% endblock headingcell %} | |
|
23 | ||
|
24 | {% block rawcell scoped %}---- Start Raw ---- | |
|
25 | {{ super() }} | |
|
26 | ---- End Raw ----{% endblock rawcell %} | |
|
27 | ||
|
28 | {% block unknowncell scoped %} | |
|
29 | unknown type {{cell.type}} | |
|
30 | {% endblock unknowncell %} | |
|
9 | 31 |
@@ -23,23 +23,9 b'' | |||
|
23 | 23 | {% block display_data scoped %} |
|
24 | 24 | # image file:{% endblock display_data %} |
|
25 | 25 | |
|
26 | {# | |
|
27 | {% block codecell scoped %} | |
|
28 | # In[{{cell.prompt_number if cell.prompt_number else ' '}}]: | |
|
29 | {% if cell.outputs %} | |
|
30 | {%- for output in cell.outputs -%} | |
|
31 | {%- if output.output_type in ['pyout','stream']%} | |
|
32 | ||
|
33 | {%- elif output.output_type in ['display_data'] %} | |
|
34 | {{"# image file: fucking display_data"}} | |
|
35 | {%- endfor -%} | |
|
36 | {% endif %} | |
|
37 | ||
|
38 | {% endblock codecell %} | |
|
39 | #} | |
|
40 | ||
|
41 | 26 | {% block markdowncell scoped %} |
|
42 |
{{ cell.source | pycomment |
|
|
27 | {{ cell.source | pycomment }} | |
|
28 | {% endblock markdowncell %} | |
|
43 | 29 | |
|
44 | 30 | {% block headingcell scoped %} |
|
45 | 31 | {{ '#' * cell.level }}{{ cell.source | pycomment}} |
General Comments 0
You need to be logged in to leave comments.
Login now