##// END OF EJS Templates
Restructuration of null.tpl and addition of inner_cell classes.
damianavila -
Show More
@@ -1,147 +1,163 b''
1 1 {%- extends 'display_priority.tpl' -%}
2 2
3 3
4 4 {% block codecell %}
5 5 <div class="cell border-box-sizing code_cell">
6 6 {{ super() }}
7 7 </div>
8 8 {%- endblock codecell %}
9 9
10 10 {% block input_group -%}
11 11 <div class="input">
12 12 {{ super() }}
13 13 </div>
14 14 {% endblock input_group %}
15 15
16 16 {% block output_group %}
17 17 <div class="output_wrapper">
18 18 <div class="output">
19 19 {{ super() }}
20 20 </div>
21 21 </div>
22 22 {% endblock output_group %}
23 23
24 24 {% block in_prompt -%}
25 25 <div class="prompt input_prompt">
26 26 In&nbsp;[{{ cell.prompt_number }}]:
27 27 </div>
28 28 {%- endblock in_prompt %}
29 29
30 30 {#
31 31 output_prompt doesn't do anything in HTML,
32 32 because there is a prompt div in each output area (see output block)
33 33 #}
34 34 {% block output_prompt %}
35 35 {% endblock output_prompt %}
36 36
37 37 {% block input %}
38 38 <div class="input_area box-flex1">
39 39 {{ cell.input | highlight2html(metadata=cell.metadata) }}
40 40 </div>
41 41 {%- endblock input %}
42 42
43 43 {% block output %}
44 44 <div class="output_area">
45 45 {%- if output.output_type == 'pyout' -%}
46 46 <div class="prompt output_prompt">
47 47 Out[{{ cell.prompt_number }}]:
48 48 {%- else -%}
49 49 <div class="prompt">
50 50 {%- endif -%}
51 51 </div>
52 52 {{ super() }}
53 53 </div>
54 54 {% endblock output %}
55 55
56 {% block markdowncell scoped %}
57 <div class="text_cell_render border-box-sizing rendered_html">
58 <div class="prompt input_prompt"></div>
56 {% block e_in_prompt -%}
57 <div class="prompt input_prompt">
58 </div>
59 {%- endblock e_in_prompt %}
60
61 {% block m_input %}
59 62 <div class="inner_cell">
63 <div class="text_cell_render border-box-sizing rendered_html">
60 64 {{ cell.source | markdown2html | strip_files_prefix }}
61 65 </div>
62 66 </div>
63 {%- endblock markdowncell %}
67 {%- endblock m_input %}
64 68
65 {% block headingcell scoped %}
69 {% block h_input %}
70 <div class="inner_cell">
66 71 <div class="text_cell_render border-box-sizing rendered_html">
67 72 {{ ("#" * cell.level + cell.source) | replace('\n', ' ') | markdown2html | strip_files_prefix | add_anchor }}
68 73 </div>
69 {% endblock headingcell %}
74 </div>
75 {% endblock h_input %}
76
77 {% block r_input %}
78 <div class="inner_cell">
79 {% if cell.metadata.get('raw_mimetype', resources.get('raw_mimetype', '')).lower() in resources.get('raw_mimetypes', ['']) %}
80 {{ cell.source }}
81 {% endif %}
82 </div>
83 {% endblock r_input %}
70 84
71 {% block unknowncell scoped %}
85 {% block u_input %}
86 <div class="inner_cell">
72 87 unknown type {{ cell.type }}
73 {% endblock unknowncell %}
88 </div>
89 {% endblock u_input %}
74 90
75 91 {% block pyout -%}
76 92 <div class="box-flex1 output_subarea output_pyout">
77 93 {% block data_priority scoped %}
78 94 {{ super() }}
79 95 {% endblock %}
80 96 </div>
81 97 {%- endblock pyout %}
82 98
83 99 {% block stream_stdout -%}
84 100 <div class="box-flex1 output_subarea output_stream output_stdout">
85 101 <pre>
86 102 {{ output.text | ansi2html }}
87 103 </pre>
88 104 </div>
89 105 {%- endblock stream_stdout %}
90 106
91 107 {% block stream_stderr -%}
92 108 <div class="box-flex1 output_subarea output_stream output_stderr">
93 109 <pre>
94 110 {{ output.text | ansi2html }}
95 111 </pre>
96 112 </div>
97 113 {%- endblock stream_stderr %}
98 114
99 115 {% block data_svg -%}
100 116 {{ output.svg }}
101 117 {%- endblock data_svg %}
102 118
103 119 {% block data_html -%}
104 120 <div class="output_html rendered_html">
105 121 {{ output.html }}
106 122 </div>
107 123 {%- endblock data_html %}
108 124
109 125 {% block data_png %}
110 126 <img src="data:image/png;base64,{{ output.png }}">
111 127 {%- endblock data_png %}
112 128
113 129 {% block data_jpg %}
114 130 <img src="data:image/jpeg;base64,{{ output.jpeg }}">
115 131 {%- endblock data_jpg %}
116 132
117 133 {% block data_latex %}
118 134 {{ output.latex }}
119 135 {%- endblock data_latex %}
120 136
121 137 {% block pyerr -%}
122 138 <div class="box-flex1 output_subarea output_pyerr">
123 139 <pre>{{ super() }}</pre>
124 140 </div>
125 141 {%- endblock pyerr %}
126 142
127 143 {%- block traceback_line %}
128 144 {{ line | ansi2html }}
129 145 {%- endblock traceback_line %}
130 146
131 147 {%- block data_text %}
132 148 <pre>
133 149 {{ output.text | ansi2html }}
134 150 </pre>
135 151 {%- endblock -%}
136 152
137 153 {%- block data_javascript %}
138 154 <script type="text/javascript">
139 155 {{ output.javascript }}
140 156 </script>
141 157 {%- endblock -%}
142 158
143 159 {%- block display_data scoped -%}
144 160 <div class="box-flex1 output_subarea output_display_data">
145 161 {{ super() }}
146 162 </div>
147 163 {%- endblock display_data -%}
@@ -1,94 +1,106 b''
1 1 {#
2 2
3 3 DO NOT USE THIS AS A BASE,
4 4 IF YOU ARE COPY AND PASTING THIS FILE
5 5 YOU ARE PROBABLY DOING THINGS INCORRECTLY.
6 6
7 7 Null template, does nothing except defining a basic structure
8 8 To layout the different blocks of a notebook.
9 9
10 10 Subtemplates can override blocks to define their custom representation.
11 11
12 12 If one of the block you do overwrite is not a leave block, consider
13 13 calling super.
14 14
15 15 {%- block nonLeaveBlock -%}
16 16 #add stuff at beginning
17 17 {{ super() }}
18 18 #add stuff at end
19 19 {%- endblock nonLeaveBlock -%}
20 20
21 21 consider calling super even if it is a leave block, we might insert more blocks later.
22 22
23 23 #}
24 24 {%- block header -%}
25 25 {%- endblock header -%}
26 26 {%- block body -%}
27 27 {%- for worksheet in nb.worksheets -%}
28 28 {%- for cell in worksheet.cells -%}
29 29 {%- block any_cell scoped -%}
30 30 {%- if cell.cell_type in ['code'] -%}
31 31 {%- block codecell scoped -%}
32 32 {%- block input_group -%}
33 33 {%- block in_prompt -%}{%- endblock in_prompt -%}
34 34 {%- block input -%}{%- endblock input -%}
35 35 {%- endblock input_group -%}
36 36 {%- if cell.outputs -%}
37 37 {%- block output_group -%}
38 38 {%- block output_prompt -%}{%- endblock output_prompt -%}
39 39 {%- block outputs scoped -%}
40 40 {%- for output in cell.outputs -%}
41 41 {%- block output scoped -%}
42 42 {%- if output.output_type in ['pyout'] -%}
43 43 {%- block pyout scoped -%}{%- endblock pyout -%}
44 44 {%- elif output.output_type in ['stream'] -%}
45 45 {%- block stream scoped -%}
46 46 {%- if output.stream in ['stdout'] -%}
47 47 {%- block stream_stdout scoped -%}
48 48 {%- endblock stream_stdout -%}
49 49 {%- elif output.stream in ['stderr'] -%}
50 50 {%- block stream_stderr scoped -%}
51 51 {%- endblock stream_stderr -%}
52 52 {%- endif -%}
53 53 {%- endblock stream -%}
54 54 {%- elif output.output_type in ['display_data'] -%}
55 55 {%- block display_data scoped -%}
56 56 {%- block data_priority scoped -%}
57 57 {%- endblock data_priority -%}
58 58 {%- endblock display_data -%}
59 59 {%- elif output.output_type in ['pyerr'] -%}
60 60 {%- block pyerr scoped -%}
61 61 {%- for line in output.traceback -%}
62 62 {%- block traceback_line scoped -%}{%- endblock traceback_line -%}
63 63 {%- endfor -%}
64 64 {%- endblock pyerr -%}
65 65 {%- endif -%}
66 66 {%- endblock output -%}
67 67 {%- endfor -%}
68 68 {%- endblock outputs -%}
69 69 {%- endblock output_group -%}
70 70 {%- endif -%}
71 71 {%- endblock codecell -%}
72 72 {%- elif cell.cell_type in ['markdown'] -%}
73 73 {%- block markdowncell scoped-%}
74 {%- block input_group -%}
75 {%- block e_in_prompt -%}{%- endblock e_in_prompt -%}
76 {%- block m_input -%}{%- endblock m_input -%}
77 {%- endblock input_group -%}
74 78 {%- endblock markdowncell -%}
75 79 {%- elif cell.cell_type in ['heading'] -%}
76 80 {%- block headingcell scoped-%}
81 {%- block input_group -%}
82 {%- block e_in_prompt -%}{%- endblock e_in_prompt -%}
83 {%- block h_input -%}{%- endblock h_input -%}
84 {%- endblock input_group -%}
77 85 {%- endblock headingcell -%}
78 86 {%- elif cell.cell_type in ['raw'] -%}
79 87 {%- block rawcell scoped -%}
80 88 {% if cell.metadata.get('raw_mimetype', '').lower() in resources.get('raw_mimetypes', ['']) %}
81 89 {{ cell.source }}
82 90 {% endif %}
83 91 {%- endblock rawcell -%}
84 92 {%- else -%}
85 93 {%- block unknowncell scoped-%}
94 {%- block input_group -%}
95 {%- block e_in_prompt -%}{%- endblock e_in_prompt -%}
96 {%- block u_input -%}{%- endblock u_input -%}
97 {%- endblock input_group -%}
86 98 {%- endblock unknowncell -%}
87 99 {%- endif -%}
88 100 {%- endblock any_cell -%}
89 101 {%- endfor -%}
90 102 {%- endfor -%}
91 103 {%- endblock body -%}
92 104
93 105 {%- block footer -%}
94 106 {%- endblock footer -%}
General Comments 0
You need to be logged in to leave comments. Login now