Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toc2: html export -- take into account number_section #810

Merged
merged 3 commits into from
Dec 3, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/jupyter_contrib_nbextensions/templates/toc2.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<script>
$( document ).ready(function(){
var cfg={'threshold':6, // depth of toc (number of levels)
'number_sections':true, // sections numbering
'number_sections': "{{nb['metadata']['toc']['number_sections']}}"=="True" ? true : false, // sections numbering
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would probably be more robust to use something like

'number_sections': {{ 'true' if nb.get('metadata', {}).get('toc', {}).get('number_sections', False) else 'false' }},

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow. Very nice!

'toc_cell':false, // useless here
'toc_window_display':true, // display the toc window
"toc_section_display": "block", // display toc contents in the window
Expand Down