1{# 2 3DO NOT USE THIS AS A BASE, 4IF YOU ARE COPY AND PASTING THIS FILE 5YOU ARE PROBABLY DOING THINGS INCORRECTLY. 6 7Null template, does nothing except defining a basic structure 8To layout the different blocks of a notebook. 9 10Subtemplates can override blocks to define their custom representation. 11 12If one of the block you do overwrite is not a leaf block, consider 13calling super. 14 15{%- block nonLeafBlock -%} 16 #add stuff at beginning 17 {{ super() }} 18 #add stuff at end 19{%- endblock nonLeafBlock -%} 20 21consider calling super even if it is a leaf block, we might insert more blocks later. 22 23#} 24{%- block header -%} 25{%- endblock header -%} 26{%- block body -%} 27 {%- block body_header -%} 28 {%- endblock body_header -%} 29 {%- block body_loop -%} 30 {%- for cell in nb.cells -%} 31 {%- block any_cell scoped -%} 32 {%- if cell.cell_type == 'code'-%} 33 {%- if resources.global_content_filter.include_code -%} 34 {%- block codecell scoped -%} 35 {%- if resources.global_content_filter.include_input and not cell.get("transient",{}).get("remove_source", false) -%} 36 {%- block input_group -%} 37 {%- if resources.global_content_filter.include_input_prompt -%} 38 {%- block in_prompt -%}{%- endblock in_prompt -%} 39 {%- endif -%} 40 {%- block input -%}{%- endblock input -%} 41 {%- endblock input_group -%} 42 {%- endif -%} 43 {%- if cell.outputs and resources.global_content_filter.include_output -%} 44 {%- block output_group -%} 45 {%- if resources.global_content_filter.include_output_prompt -%} 46 {%- block output_prompt -%}{%- endblock output_prompt -%} 47 {%- endif -%} 48 {%- block outputs scoped -%} 49 {%- for output in cell.outputs -%} 50 {%- block output scoped -%} 51 {%- if output.output_type == 'execute_result' -%} 52 {%- block execute_result scoped -%}{%- endblock execute_result -%} 53 {%- elif output.output_type == 'stream' -%} 54 {%- block stream scoped -%} 55 {%- if output.name == 'stdout' -%} 56 {%- block stream_stdout scoped -%} 57 {%- endblock stream_stdout -%} 58 {%- elif output.name == 'stderr' -%} 59 {%- block stream_stderr scoped -%} 60 {%- endblock stream_stderr -%} 61 {%- elif output.name == 'stdin' -%} 62 {%- block stream_stdin scoped -%} 63 {%- endblock stream_stdin -%} 64 {%- endif -%} 65 {%- endblock stream -%} 66 {%- elif output.output_type == 'display_data' -%} 67 {%- block display_data scoped -%} 68 {%- block data_priority scoped -%} 69 {%- endblock data_priority -%} 70 {%- endblock display_data -%} 71 {%- elif output.output_type == 'error' -%} 72 {%- block error scoped -%} 73 {%- for line in output.traceback -%} 74 {%- block traceback_line scoped -%}{%- endblock traceback_line -%} 75 {%- endfor -%} 76 {%- endblock error -%} 77 {%- endif -%} 78 {%- endblock output -%} 79 {%- endfor -%} 80 {%- endblock outputs -%} 81 {%- endblock output_group -%} 82 {%- endif -%} 83 {%- endblock codecell -%} 84 {%- endif -%} 85 {%- elif cell.cell_type in ['markdown'] -%} 86 {%- if resources.global_content_filter.include_markdown and not cell.get("transient",{}).get("remove_source", false) -%} 87 {%- block markdowncell scoped-%} {%- endblock markdowncell -%} 88 {%- endif -%} 89 {%- elif cell.cell_type in ['raw'] -%} 90 {%- if resources.global_content_filter.include_raw and not cell.get("transient",{}).get("remove_source", false) -%} 91 {%- block rawcell scoped -%} 92 {%- if cell.metadata.get('raw_mimetype', '').lower() in resources.get('raw_mimetypes', ['']) -%} 93 {{ cell.source }} 94 {%- endif -%} 95 {%- endblock rawcell -%} 96 {%- endif -%} 97 {%- else -%} 98 {%- if resources.global_content_filter.include_unknown and not cell.get("transient",{}).get("remove_source", false) -%} 99 {%- block unknowncell scoped-%} 100 {%- endblock unknowncell -%} 101 {%- endif -%} 102 {%- endif -%} 103 {%- endblock any_cell -%} 104 {%- endfor -%} 105 {%- endblock body_loop -%} 106 {%- block body_footer -%} 107 {%- endblock body_footer -%} 108{%- endblock body -%} 109 110{%- block footer -%} 111{%- endblock footer -%} 112