null.tpl
89 lines
| 3.9 KiB
| application/vnd.groove-tool-template
|
SmartyLexer
Matthias BUSSONNIER
|
r9583 | {# | ||
Jonathan Frederic
|
r12658 | DO NOT USE THIS AS A BASE, | ||
Matthias BUSSONNIER
|
r9588 | IF YOU ARE COPY AND PASTING THIS FILE | ||
Jonathan Frederic
|
r12658 | YOU ARE PROBABLY DOING THINGS INCORRECTLY. | ||
Matthias BUSSONNIER
|
r9588 | |||
Jonathan Frederic
|
r12658 | Null template, does nothing except defining a basic structure | ||
MinRK
|
r10041 | To layout the different blocks of a notebook. | ||
Matthias BUSSONNIER
|
r9583 | |||
MinRK
|
r10041 | Subtemplates can override blocks to define their custom representation. | ||
Matthias BUSSONNIER
|
r9583 | |||
MinRK
|
r10041 | If one of the block you do overwrite is not a leave block, consider | ||
Matthias BUSSONNIER
|
r9583 | calling super. | ||
Matthias BUSSONNIER
|
r9587 | {%- block nonLeaveBlock -%} | ||
Matthias BUSSONNIER
|
r9583 | #add stuff at beginning | ||
{{ super() }} | ||||
#add stuff at end | ||||
Matthias BUSSONNIER
|
r9587 | {%- endblock nonLeaveBlock -%} | ||
Matthias BUSSONNIER
|
r9583 | |||
MinRK
|
r10041 | consider calling super even if it is a leave block, we might insert more blocks later. | ||
Matthias BUSSONNIER
|
r9583 | |||
#} | ||||
Matthias BUSSONNIER
|
r9588 | {%- block header -%} | ||
{%- endblock header -%} | ||||
{%- block body -%} | ||||
MinRK
|
r18580 | {%- for cell in nb.cells -%} | ||
{%- block any_cell scoped -%} | ||||
{%- if cell.cell_type == 'code' -%} | ||||
{%- block codecell scoped -%} | ||||
{%- block input_group -%} | ||||
{%- block in_prompt -%}{%- endblock in_prompt -%} | ||||
{%- block input -%}{%- endblock input -%} | ||||
{%- endblock input_group -%} | ||||
{%- if cell.outputs -%} | ||||
{%- block output_group -%} | ||||
{%- block output_prompt -%}{%- endblock output_prompt -%} | ||||
{%- block outputs scoped -%} | ||||
{%- for output in cell.outputs -%} | ||||
{%- block output scoped -%} | ||||
{%- if output.output_type == 'execute_result' -%} | ||||
{%- block execute_result scoped -%}{%- endblock execute_result -%} | ||||
{%- elif output.output_type == 'stream' -%} | ||||
{%- block stream scoped -%} | ||||
{%- if output.name == 'stdout' -%} | ||||
{%- block stream_stdout scoped -%} | ||||
{%- endblock stream_stdout -%} | ||||
{%- elif output.name == 'stderr' -%} | ||||
{%- block stream_stderr scoped -%} | ||||
{%- endblock stream_stderr -%} | ||||
{%- endif -%} | ||||
{%- endblock stream -%} | ||||
{%- elif output.output_type == 'display_data' -%} | ||||
{%- block display_data scoped -%} | ||||
{%- block data_priority scoped -%} | ||||
{%- endblock data_priority -%} | ||||
{%- endblock display_data -%} | ||||
{%- elif output.output_type == 'error' -%} | ||||
{%- block error scoped -%} | ||||
{%- for line in output.traceback -%} | ||||
{%- block traceback_line scoped -%}{%- endblock traceback_line -%} | ||||
{%- endfor -%} | ||||
{%- endblock error -%} | ||||
{%- endif -%} | ||||
{%- endblock output -%} | ||||
{%- endfor -%} | ||||
{%- endblock outputs -%} | ||||
{%- endblock output_group -%} | ||||
{%- endif -%} | ||||
{%- endblock codecell -%} | ||||
{%- elif cell.cell_type in ['markdown'] -%} | ||||
{%- block markdowncell scoped-%} | ||||
{%- endblock markdowncell -%} | ||||
{%- elif cell.cell_type in ['raw'] -%} | ||||
{%- block rawcell scoped -%} | ||||
{% if cell.metadata.get('raw_mimetype', '').lower() in resources.get('raw_mimetypes', ['']) %} | ||||
{{ cell.source }} | ||||
{% endif %} | ||||
{%- endblock rawcell -%} | ||||
{%- else -%} | ||||
{%- block unknowncell scoped-%} | ||||
{%- endblock unknowncell -%} | ||||
{%- endif -%} | ||||
{%- endblock any_cell -%} | ||||
Matthias BUSSONNIER
|
r9580 | {%- endfor -%} | ||
Matthias BUSSONNIER
|
r9588 | {%- endblock body -%} | ||
Matthias BUSSONNIER
|
r9580 | |||
Matthias BUSSONNIER
|
r9588 | {%- block footer -%} | ||
{%- endblock footer -%} | ||||