##// END OF EJS Templates
Post code-review, extended refactor.
Post code-review, extended refactor.

File last commit:

r10482:87812de9
r10485:1de3574b
Show More
null.tpl
91 lines | 4.1 KiB | application/vnd.groove-tool-template | SmartyLexer
Matthias BUSSONNIER
inheritance example and doc
r9583 {#
Matthias BUSSONNIER
require jinja, merge base templates
r9588 DO NOT USE THIS AS A BASE WORK,
IF YOU ARE COPY AND PASTING THIS FILE
YOU ARE PROBABLY DOING THINGS WRONG.
Matthias BUSSONNIER
inheritance example and doc
r9583 Null template, Does nothing except defining a basic structure
MinRK
fix div hierarchy for outputs...
r10041 To layout the different blocks of a notebook.
Matthias BUSSONNIER
inheritance example and doc
r9583
MinRK
fix div hierarchy for outputs...
r10041 Subtemplates can override blocks to define their custom representation.
Matthias BUSSONNIER
inheritance example and doc
r9583
MinRK
fix div hierarchy for outputs...
r10041 If one of the block you do overwrite is not a leave block, consider
Matthias BUSSONNIER
inheritance example and doc
r9583 calling super.
Matthias BUSSONNIER
ensure base templates returns 0 length file as they should
r9587 {%- block nonLeaveBlock -%}
Matthias BUSSONNIER
inheritance example and doc
r9583 #add stuff at beginning
{{ super() }}
#add stuff at end
Matthias BUSSONNIER
ensure base templates returns 0 length file as they should
r9587 {%- endblock nonLeaveBlock -%}
Matthias BUSSONNIER
inheritance example and doc
r9583
MinRK
fix div hierarchy for outputs...
r10041 consider calling super even if it is a leave block, we might insert more blocks later.
Matthias BUSSONNIER
inheritance example and doc
r9583
#}
Matthias BUSSONNIER
require jinja, merge base templates
r9588 {%- block header -%}
{%- endblock header -%}
{%- block body -%}
Matthias BUSSONNIER
preprocessing and namespace fix...
r9604 {%- for worksheet in nb.worksheets -%}
Matthias BUSSONNIER
require jinja, merge base templates
r9588 {%- for cell in worksheet.cells -%}
{%- block any_cell scoped -%}
{%- if cell.type in ['code'] -%}
{%- block codecell scoped -%}
Matthias BUSSONNIER
working on html
r9590 {%- block input_group -%}
{%- block in_prompt -%}{%- endblock in_prompt -%}
{%- block input -%}{%- endblock input -%}
{%- endblock input_group -%}
MinRK
fix div hierarchy for outputs...
r10041 {%- if cell.outputs -%}
Matthias BUSSONNIER
some other fixes
r9591 {%- block output_group -%}
MinRK
fix div hierarchy for outputs...
r10041 {%- block output_prompt -%}{%- endblock output_prompt -%}
{%- block outputs scoped -%}
{%- for output in cell.outputs -%}
{%- block output scoped -%}
Matthias BUSSONNIER
working on html
r9590 {%- if output.output_type in ['pyout'] -%}
{%- block pyout scoped -%}{%- endblock pyout -%}
{%- elif output.output_type in ['stream'] -%}
Matthias BUSSONNIER
fix some stream/pyout/pyerr
r9600 {%- 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
working on html
r9590 {%- elif output.output_type in ['display_data'] -%}
Matthias BUSSONNIER
try to play with data display priority
r9599 {%- block display_data scoped -%}
{%- block data_priority scoped -%}
{%- endblock data_priority -%}
{%- endblock display_data -%}
Matthias BUSSONNIER
working on html
r9590 {%- 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 -%}
MinRK
fix div hierarchy for outputs...
r10041 {%- endblock output -%}
{%- endfor -%}
{%- endblock outputs -%}
Matthias BUSSONNIER
working on html
r9590 {%- endblock output_group -%}
MinRK
fix div hierarchy for outputs...
r10041 {%- endif -%}
Matthias BUSSONNIER
require jinja, merge base templates
r9588 {%- 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
null template
r9580 {%- endfor -%}
Matthias BUSSONNIER
require jinja, merge base templates
r9588 {%- endblock body -%}
Matthias BUSSONNIER
null template
r9580
Matthias BUSSONNIER
require jinja, merge base templates
r9588 {%- block footer -%}
{%- endblock footer -%}