null.tpl 5.1 KB

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