|
| 1 | +{%- extends 'display_priority.tpl' -%} |
| 2 | +{% from 'celltags.tpl' import celltags %} |
| 3 | + |
| 4 | +{% block codecell %} |
| 5 | +<div class="cell border-box-sizing code_cell rendered{{ celltags(cell) }}"> |
| 6 | +{{ super() }} |
| 7 | +</div> |
| 8 | +{%- endblock codecell %} |
| 9 | + |
| 10 | +{% block input_group -%} |
| 11 | +<div class="input"> |
| 12 | +{{ super() }} |
| 13 | +</div> |
| 14 | +{% endblock input_group %} |
| 15 | + |
| 16 | +{% block output_group %} |
| 17 | +<div class="output_wrapper"> |
| 18 | +<div class="output"> |
| 19 | +{{ super() }} |
| 20 | +</div> |
| 21 | +</div> |
| 22 | +{% endblock output_group %} |
| 23 | + |
| 24 | +{% block in_prompt -%} |
| 25 | +<div class="prompt input_prompt"> |
| 26 | + {%- if cell.execution_count is defined -%} |
| 27 | + In [{{ cell.execution_count|replace(None, " ") }}]: |
| 28 | + {%- else -%} |
| 29 | + In [ ]: |
| 30 | + {%- endif -%} |
| 31 | +</div> |
| 32 | +{%- endblock in_prompt %} |
| 33 | + |
| 34 | +{% block empty_in_prompt -%} |
| 35 | +<div class="prompt input_prompt"> |
| 36 | +</div> |
| 37 | +{%- endblock empty_in_prompt %} |
| 38 | + |
| 39 | +{# |
| 40 | + output_prompt doesn't do anything in HTML, |
| 41 | + because there is a prompt div in each output area (see output block) |
| 42 | +#} |
| 43 | +{% block output_prompt %} |
| 44 | +{% endblock output_prompt %} |
| 45 | +{% block input %} |
| 46 | +<div class="inner_cell"> |
| 47 | + <div class="input_area"> |
| 48 | +{{ cell.source | highlight_code(metadata=cell.metadata) }} |
| 49 | + </div> |
| 50 | +</div> |
| 51 | +{%- endblock input %} |
| 52 | +{% block output_area_prompt %} |
| 53 | +{%- if output.output_type == 'execute_result' -%} |
| 54 | + <div class="prompt output_prompt"> |
| 55 | + {%- if cell.execution_count is defined -%} |
| 56 | + Out[{{ cell.execution_count|replace(None, " ") }}]: |
| 57 | + {%- else -%} |
| 58 | + Out[ ]: |
| 59 | + {%- endif -%} |
| 60 | +{%- else -%} |
| 61 | + <div class="prompt"> |
| 62 | +{%- endif -%} |
| 63 | + </div> |
| 64 | +{% endblock output_area_prompt %} |
| 65 | +{% block output %} |
| 66 | +<div class="output_area"> |
| 67 | +{% if resources.global_content_filter.include_output_prompt %} |
| 68 | + {{ self.output_area_prompt() }} |
| 69 | +{% endif %} |
| 70 | +{{ super() }} |
| 71 | +</div> |
| 72 | +{% endblock output %} |
| 73 | +{% block markdowncell scoped %} |
| 74 | +<div class="cell border-box-sizing text_cell rendered{{ celltags(cell) }}"> |
| 75 | +{%- if resources.global_content_filter.include_input_prompt-%} |
| 76 | + {{ self.empty_in_prompt() }} |
| 77 | +{%- endif -%} |
| 78 | +<div class="inner_cell"> |
| 79 | +<div class="text_cell_render border-box-sizing rendered_html"> |
| 80 | +{{ cell.source | markdown2html | strip_files_prefix }} |
| 81 | +</div> |
| 82 | +</div> |
| 83 | +</div> |
| 84 | +{%- endblock markdowncell %} |
| 85 | +{% block unknowncell scoped %} |
| 86 | +unknown type {{ cell.type }} |
| 87 | +{% endblock unknowncell %} |
| 88 | +{% block execute_result -%} |
| 89 | +{%- set extra_class="output_execute_result" -%} |
| 90 | +{% block data_priority scoped %} |
| 91 | +{{ super() }} |
| 92 | +{% endblock data_priority %} |
| 93 | +{%- set extra_class="" -%} |
| 94 | +{%- endblock execute_result %} |
| 95 | +{% block stream_stdout -%} |
| 96 | +<div class="output_subarea output_stream output_stdout output_text"> |
| 97 | +<pre> |
| 98 | +{{- output.text | ansi2html -}} |
| 99 | +</pre> |
| 100 | +</div> |
| 101 | +{%- endblock stream_stdout %} |
| 102 | +{% block stream_stderr -%} |
| 103 | +<div class="output_subarea output_stream output_stderr output_text"> |
| 104 | +<pre> |
| 105 | +{{- output.text | ansi2html -}} |
| 106 | +</pre> |
| 107 | +</div> |
| 108 | +{%- endblock stream_stderr %} |
| 109 | +{% block data_svg scoped -%} |
| 110 | +<div class="output_svg output_subarea {{ extra_class }}"> |
| 111 | +{%- if output.svg_filename %} |
| 112 | +<img src="{{ output.svg_filename | posix_path }}"> |
| 113 | +{%- else %} |
| 114 | +{{ output.data['image/svg+xml'] }} |
| 115 | +{%- endif %} |
| 116 | +</div> |
| 117 | +{%- endblock data_svg %} |
| 118 | +{% block data_html scoped -%} |
| 119 | +<div class="output_html rendered_html output_subarea {{ extra_class }}"> |
| 120 | +{{ output.data['text/html'] }} |
| 121 | +</div> |
| 122 | +{%- endblock data_html %} |
| 123 | +{% block data_markdown scoped -%} |
| 124 | +<div class="output_markdown rendered_html output_subarea {{ extra_class }}"> |
| 125 | +{{ output.data['text/markdown'] | markdown2html }} |
| 126 | +</div> |
| 127 | +{%- endblock data_markdown %} |
| 128 | +{% block data_png scoped %} |
| 129 | +<div class="output_png output_subarea {{ extra_class }}"> |
| 130 | +{%- if 'image/png' in output.metadata.get('filenames', {}) %} |
| 131 | +<img src="{{ output.metadata.filenames['image/png'] | posix_path }}" |
| 132 | +{%- else %} |
| 133 | +<img src="data:image/png;base64,{{ output.data['image/png'] }}" |
| 134 | +{%- endif %} |
| 135 | +{%- set width=output | get_metadata('width', 'image/png') -%} |
| 136 | +{%- if width is not none %} |
| 137 | +width={{ width }} |
| 138 | +{%- endif %} |
| 139 | +{%- set height=output | get_metadata('height', 'image/png') -%} |
| 140 | +{%- if height is not none %} |
| 141 | +height={{ height }} |
| 142 | +{%- endif %} |
| 143 | +{%- if output | get_metadata('unconfined', 'image/png') %} |
| 144 | +class="unconfined" |
| 145 | +{%- endif %} |
| 146 | +{%- set alttext=(output | get_metadata('alt', 'image/png')) or (cell | get_metadata('alt')) -%} |
| 147 | +{%- if alttext is not none %} |
| 148 | +alt="{{ alttext }}" |
| 149 | +{%- endif %} |
| 150 | +> |
| 151 | +</div> |
| 152 | +{%- endblock data_png %} |
| 153 | +{% block data_jpg scoped %} |
| 154 | +<div class="output_jpeg output_subarea {{ extra_class }}"> |
| 155 | +{%- if 'image/jpeg' in output.metadata.get('filenames', {}) %} |
| 156 | +<img src="{{ output.metadata.filenames['image/jpeg'] | posix_path }}" |
| 157 | +{%- else %} |
| 158 | +<img src="data:image/jpeg;base64,{{ output.data['image/jpeg'] }}" |
| 159 | +{%- endif %} |
| 160 | +{%- set width=output | get_metadata('width', 'image/jpeg') -%} |
| 161 | +{%- if width is not none %} |
| 162 | +width={{ width }} |
| 163 | +{%- endif %} |
| 164 | +{%- set height=output | get_metadata('height', 'image/jpeg') -%} |
| 165 | +{%- if height is not none %} |
| 166 | +height={{ height }} |
| 167 | +{%- endif %} |
| 168 | +{%- if output | get_metadata('unconfined', 'image/jpeg') %} |
| 169 | +class="unconfined" |
| 170 | +{%- endif %} |
| 171 | +{%- set alttext=(output | get_metadata('alt', 'image/jpeg')) or (cell | get_metadata('alt')) -%} |
| 172 | +{%- if alttext is not none %} |
| 173 | +alt="{{ alttext }}" |
| 174 | +{%- endif %} |
| 175 | +> |
| 176 | +</div> |
| 177 | +{%- endblock data_jpg %} |
| 178 | +{% block data_latex scoped %} |
| 179 | +<div class="output_latex output_subarea {{ extra_class }}"> |
| 180 | +{{ output.data['text/latex'] }} |
| 181 | +</div> |
| 182 | +{%- endblock data_latex %} |
| 183 | +{% block error -%} |
| 184 | +<div class="output_subarea output_text output_error"> |
| 185 | +<pre> |
| 186 | +{{- super() -}} |
| 187 | +</pre> |
| 188 | +</div> |
| 189 | +{%- endblock error %} |
| 190 | +{%- block traceback_line %} |
| 191 | +{{ line | ansi2html }} |
| 192 | +{%- endblock traceback_line %} |
| 193 | +{%- block data_text scoped %} |
| 194 | +<div class="output_text output_subarea {{ extra_class }}"> |
| 195 | +<pre> |
| 196 | +{{- output.data['text/plain'] | ansi2html -}} |
| 197 | +</pre> |
| 198 | +</div> |
| 199 | +{%- endblock -%} |
| 200 | +{%- block data_javascript scoped %} |
| 201 | +{% set div_id = uuid4() %} |
| 202 | +<div id="{{ div_id }}"></div> |
| 203 | +<div class="output_subarea output_javascript {{ extra_class }}"> |
| 204 | +<script type="text/javascript"> |
| 205 | +var element = $('#{{ div_id }}'); |
| 206 | +{{ output.data['application/javascript'] }} |
| 207 | +</script> |
| 208 | +</div> |
| 209 | +{%- endblock -%} |
| 210 | + |
| 211 | +{%- block data_widget_state scoped %} |
| 212 | +{% set div_id = uuid4() %} |
| 213 | +{% set datatype_list = output.data | filter_data_type %} |
| 214 | +{% set datatype = datatype_list[0]%} |
| 215 | +<div id="{{ div_id }}"></div> |
| 216 | +<div class="output_subarea output_widget_state {{ extra_class }}"> |
| 217 | +<script type="text/javascript"> |
| 218 | +var element = $('#{{ div_id }}'); |
| 219 | +</script> |
| 220 | +<script type="{{ datatype }}"> |
| 221 | +{{ output.data[datatype] | json_dumps }} |
| 222 | +</script> |
| 223 | +</div> |
| 224 | +{%- endblock data_widget_state -%} |
| 225 | + |
| 226 | +{%- block data_widget_view scoped %} |
| 227 | +{% set div_id = uuid4() %} |
| 228 | +{% set datatype_list = output.data | filter_data_type %} |
| 229 | +{% set datatype = datatype_list[0]%} |
| 230 | +<div id="{{ div_id }}"></div> |
| 231 | +<div class="output_subarea output_widget_view {{ extra_class }}"> |
| 232 | +<script type="text/javascript"> |
| 233 | +var element = $('#{{ div_id }}'); |
| 234 | +</script> |
| 235 | +<script type="{{ datatype }}"> |
| 236 | +{{ output.data[datatype] | json_dumps }} |
| 237 | +</script> |
| 238 | +</div> |
| 239 | +{%- endblock data_widget_view -%} |
| 240 | + |
| 241 | +{%- block footer %} |
| 242 | +{% set mimetype = 'application/vnd.jupyter.widget-state+json'%} |
| 243 | +{% if mimetype in nb.metadata.get("widgets",{})%} |
| 244 | +<script type="{{ mimetype }}"> |
| 245 | +{{ nb.metadata.widgets[mimetype] | json_dumps }} |
| 246 | +</script> |
| 247 | +{% endif %} |
| 248 | +{{ super() }} |
| 249 | +{%- endblock footer-%} |
0 commit comments