diff --git a/nbconvert/exporters/templateexporter.py b/nbconvert/exporters/templateexporter.py index 9893b5fc3..f98971e6d 100644 --- a/nbconvert/exporters/templateexporter.py +++ b/nbconvert/exporters/templateexporter.py @@ -684,8 +684,5 @@ def _init_resources(self, resources): return resources def include_tableofcontents(self, resources): - # if len(resources["tableofcontents"])>0: - return True - - # else: - # return False + return True + diff --git a/share/templates/base/null.j2 b/share/templates/base/null.j2 index 547ddb458..888c68a6c 100644 --- a/share/templates/base/null.j2 +++ b/share/templates/base/null.j2 @@ -21,9 +21,12 @@ 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 %} + {% 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 %}