null.tpl
89 lines
| 4.1 KiB
| application/vnd.groove-tool-template
|
SmartyLexer
/ templates / null.tpl
Matthias BUSSONNIER
|
r9005 | {# | ||
Matthias BUSSONNIER
|
r9013 | DO NOT USE THIS AS A BASE WORK, | ||
IF YOU ARE COPY AND PASTING THIS FILE | ||||
YOU ARE PROBABLY DOING THINGS WRONG. | ||||
Matthias BUSSONNIER
|
r9005 | Null template, Does nothing except defining a basic structure | ||
To layout the diferents blocks of a notebook. | ||||
Subtemplates can Override Blocks to define their custom reresentation. | ||||
Matthias BUSSONNIER
|
r9013 | If one of the block you do overrite is not a leave block, consider | ||
Matthias BUSSONNIER
|
r9005 | calling super. | ||
Matthias BUSSONNIER
|
r9012 | {%- block nonLeaveBlock -%} | ||
Matthias BUSSONNIER
|
r9005 | #add stuff at beginning | ||
{{ super() }} | ||||
#add stuff at end | ||||
Matthias BUSSONNIER
|
r9012 | {%- endblock nonLeaveBlock -%} | ||
Matthias BUSSONNIER
|
r9005 | |||
consider calling super even if block is leave block, we might insert more block later. | ||||
#} | ||||
Matthias BUSSONNIER
|
r9013 | {%- block header -%} | ||
{%- endblock header -%} | ||||
{%- block body -%} | ||||
Matthias BUSSONNIER
|
r9185 | {%- for worksheet in nb.worksheets -%} | ||
Matthias BUSSONNIER
|
r9013 | {%- for cell in worksheet.cells -%} | ||
{%- block any_cell scoped -%} | ||||
{%- if cell.type in ['code'] -%} | ||||
{%- block codecell scoped -%} | ||||
Matthias BUSSONNIER
|
r9015 | {%- block input_group -%} | ||
{%- block in_prompt -%}{%- endblock in_prompt -%} | ||||
{%- block input -%}{%- endblock input -%} | ||||
{%- endblock input_group -%} | ||||
{%- if cell.outputs -%} | ||||
Matthias BUSSONNIER
|
r9016 | {%- block output_group -%} | ||
Matthias BUSSONNIER
|
r9015 | {%- block output_prompt -%}{%- endblock output_prompt -%} | ||
{%- block outputs -%} | ||||
{%- for output in cell.outputs -%} | ||||
{%- if output.output_type in ['pyout'] -%} | ||||
{%- block pyout scoped -%}{%- endblock pyout -%} | ||||
{%- elif output.output_type in ['stream'] -%} | ||||
Matthias BUSSONNIER
|
r9050 | {%- block stream scoped -%} | ||
{%- if output.stream in ['stdout'] -%} | ||||
{%- block stream_stdout scoped -%} | ||||
{%- endblock stream_stdout -%} | ||||
{%- elif output.stream in ['stderr'] -%} | ||||
{%- block stream_stderr scoped -%} | ||||
{%- endblock stream_stderr -%} | ||||
{%- endif -%} | ||||
{%- endblock stream -%} | ||||
Matthias BUSSONNIER
|
r9015 | {%- elif output.output_type in ['display_data'] -%} | ||
Matthias BUSSONNIER
|
r9049 | {%- block display_data scoped -%} | ||
{%- block data_priority scoped -%} | ||||
{%- endblock data_priority -%} | ||||
{%- endblock display_data -%} | ||||
Matthias BUSSONNIER
|
r9015 | {%- elif output.output_type in ['pyerr'] -%} | ||
{%- block pyerr scoped -%} | ||||
{%- for line in output.traceback -%} | ||||
{%- block traceback_line scoped -%}{%- endblock traceback_line -%} | ||||
{%- endfor -%} | ||||
{%- endblock pyerr -%} | ||||
{%- endif -%} | ||||
{%- endfor -%} | ||||
{%- endblock outputs -%} | ||||
{%- endblock output_group -%} | ||||
Matthias BUSSONNIER
|
r9016 | {%- endif -%} | ||
Matthias BUSSONNIER
|
r9013 | {%- endblock codecell -%} | ||
{%- elif cell.type in ['markdown'] -%} | ||||
{%- block markdowncell scoped-%} | ||||
{%- endblock markdowncell -%} | ||||
{%- elif cell.type in ['heading'] -%} | ||||
{%- block headingcell scoped-%} | ||||
{%- endblock headingcell -%} | ||||
{%- elif cell.type in ['raw'] -%} | ||||
{%- block rawcell scoped-%} | ||||
{%- endblock rawcell -%} | ||||
{%- else -%} | ||||
{%- block unknowncell scoped-%} | ||||
{%- endblock unknowncell -%} | ||||
{%- endif -%} | ||||
{%- endblock any_cell -%} | ||||
{%- endfor -%} | ||||
Matthias BUSSONNIER
|
r8997 | {%- endfor -%} | ||
Matthias BUSSONNIER
|
r9013 | {%- endblock body -%} | ||
Matthias BUSSONNIER
|
r8997 | |||
Matthias BUSSONNIER
|
r9013 | {%- block footer -%} | ||
{%- endblock footer -%} | ||||