Skip to content

Commit 6dc75c3

Browse files
authored
Undefined title_sidebar
In some "old" exported html files, with toc2 embedded, the `cfg.title_sidebar` is not defined; This tests for the cfg key and define it if necessary (Otherwise the sidebar title appears as "undefined")
1 parent ac92192 commit 6dc75c3

File tree

1 file changed

+3
-0
lines changed
  • src/jupyter_contrib_nbextensions/nbextensions/toc2

1 file changed

+3
-0
lines changed

src/jupyter_contrib_nbextensions/nbextensions/toc2/toc2.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,9 @@
537537
var ul = $('<ul/>').addClass('toc-item');
538538

539539
// update sidebar/window title
540+
if (typeof cfg.title_sidebar === 'undefined') { // For backwards compatibility:
541+
cfg.title_sidebar = "Contents" // May not be defined in some non-live notebooks
542+
};
540543
$('#toc-header > .header').text(cfg.title_sidebar + ' ');
541544

542545
// update toc element

0 commit comments

Comments
 (0)