Skip to content

Commit

Permalink
Undefined title_sidebar
Browse files Browse the repository at this point in the history
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")
  • Loading branch information
jfbercher authored Dec 17, 2017
1 parent ac92192 commit 6dc75c3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/jupyter_contrib_nbextensions/nbextensions/toc2/toc2.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,9 @@
var ul = $('<ul/>').addClass('toc-item');

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

// update toc element
Expand Down

0 comments on commit 6dc75c3

Please sign in to comment.