diff --git a/nbconvert/exporters/templateexporter.py b/nbconvert/exporters/templateexporter.py index 9893b5fc3..0b8c27f41 100644 --- a/nbconvert/exporters/templateexporter.py +++ b/nbconvert/exporters/templateexporter.py @@ -683,9 +683,7 @@ def _init_resources(self, resources): resources["include_tableofcontents"] = self.include_tableofcontents return resources - def include_tableofcontents(self, resources): - # if len(resources["tableofcontents"])>0: + def include_tableofcontents(self): return True - - # else: - # return False + + diff --git a/share/templates/base/null.j2 b/share/templates/base/null.j2 index 547ddb458..9e5ad0ecb 100644 --- a/share/templates/base/null.j2 +++ b/share/templates/base/null.j2 @@ -21,9 +21,13 @@ calling super. consider calling super even if it is a leaf block, we might insert more blocks later. #} +{%- block header -%} +{%- endblock header -%} {%- block body -%} {%- block body_header -%} -
{{"Hello \n\"World\""}}
+ {% block tableofcontents %} + {{super ()}} + {% endblock tableofcontents %} {%- endblock body_header -%} {%- block body_loop -%} {%- for cell in nb.cells -%} diff --git a/share/templates/lab/base.html.j2 b/share/templates/lab/base.html.j2 index b4001ea2c..85d4081ec 100644 --- a/share/templates/lab/base.html.j2 +++ b/share/templates/lab/base.html.j2 @@ -3,8 +3,9 @@ {% from 'cell_id_anchor.j2' import cell_id_anchor %} {% block tableofcontents %} -
{{"Table of contents"}}
- +
{{"Table of contents"}} + {{ super() }} +
{% endblock tableofcontents %} {% block codecell %}