Skip to content

♻️ REFACTOR: Delegate ToC logic to sphinx-external-toc #1293

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

Merged
merged 20 commits into from
May 5, 2021
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
root: intro

defaults:
titlesonly: true

parts:

- caption: Get started
Expand Down
2 changes: 1 addition & 1 deletion jupyter_book/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def build(
get_config_only=False,
):
"""Convert your book's or page's content to HTML or a PDF."""
from sphinx_external_toc.api import MalformedError, parse_toc_yaml
from sphinx_external_toc.parsing import MalformedError, parse_toc_yaml

from jupyter_book import __version__ as jbv
from jupyter_book.sphinx import build_sphinx
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"nbconvert<6",
'importlib_metadata; python_version < "3.7"',
"jsonschema",
"sphinx-external-toc==0.1.0a3",
"sphinx-external-toc==0.1.0a5",
"sphinx_togglebutton",
"sphinx-copybutton",
"sphinx-comments",
Expand Down
2 changes: 2 additions & 0 deletions tests/books/clean_cache/_toc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
root: index
defaults:
titlesonly: true
2 changes: 2 additions & 0 deletions tests/books/config/_toc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
root: index
defaults:
titlesonly: true
2 changes: 2 additions & 0 deletions tests/books/config_custombuilder/_toc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
root: index
defaults:
titlesonly: true
2 changes: 2 additions & 0 deletions tests/books/nested-pdflatex/_toc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
root: source/index
defaults:
titlesonly: true
sections:
- file: source/content
sections:
Expand Down
2 changes: 2 additions & 0 deletions tests/books/nested/_toc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
root: intro
defaults:
titlesonly: true
sections:
- file: contents/markdown
2 changes: 2 additions & 0 deletions tests/books/sphinx_syntaxerr/_toc.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
root: index
title: Toc
defaults:
titlesonly: true
2 changes: 2 additions & 0 deletions tests/books/toc/_toc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
root: index
title: Toc
defaults:
titlesonly: true
sections:
- file: content1
title: Content1
Expand Down
2 changes: 2 additions & 0 deletions tests/books/toc/_toc_emptysections.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
root: index
title: Toc
defaults:
titlesonly: true
parts:
- caption: Empty chapter
- caption: A section
Expand Down
30 changes: 16 additions & 14 deletions tests/books/toc/_toc_mixedpartsfiles.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
- file: index
title: Toc
root: index
defaults:
titlesonly: true
title: Toc
sections:
- file: content1
title: Content1
- file: content2
title: Content2
- file: content3
title: Content3
- part: My chapter
sections:
- file: content1
title: Content1
- file: content2
title: Content2
- file: content3
title: Content3
- part: My chapter
- file: subfolder/index
title: Subfolder
sections:
- file: subfolder/index
title: Subfolder
sections:
- file: subfolder/asubpage
title: Asubpage
- file: subfolder/asubpage
title: Asubpage
2 changes: 2 additions & 0 deletions tests/books/toc/_toc_nofileorurl.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
root: index
title: Toc
defaults:
titlesonly: true
parts:
- caption: A section
sections:
Expand Down
6 changes: 4 additions & 2 deletions tests/books/toc/_toc_numbered.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
defaults:
numbered: true
root: index
title: Toc
defaults:
titlesonly: true
options:
numbered: true
sections:
- file: content1
title: Content1
Expand Down
6 changes: 4 additions & 2 deletions tests/books/toc/_toc_numbered_depth.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
defaults:
numbered: 1
root: index
title: Toc
defaults:
titlesonly: true
options:
numbered: 1
sections:
- file: content1
title: Content1
Expand Down
2 changes: 2 additions & 0 deletions tests/books/toc/_toc_numbered_depth_parts_subset.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
root: index
title: Toc
defaults:
titlesonly: true
parts:
- caption: Chapter 1
numbered: true
Expand Down
6 changes: 4 additions & 2 deletions tests/books/toc/_toc_numbered_parts.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
defaults:
numbered: true
root: index
title: Toc
defaults:
titlesonly: true
parts:
- caption: Chapter 1
numbered: true
sections:
- file: content1
title: Content1
Expand All @@ -13,6 +14,7 @@ parts:
- file: subfolder/asubpage
title: Asubpage
- caption: Chapter 2
numbered: true
sections:
- file: content2
title: Content2
Expand Down
2 changes: 2 additions & 0 deletions tests/books/toc/_toc_numbered_parts_subset.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
root: index
title: Toc
defaults:
titlesonly: true
parts:
- caption: Chapter 1
numbered: true
Expand Down
2 changes: 2 additions & 0 deletions tests/books/toc/_toc_parts.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
root: index
title: Toc
defaults:
titlesonly: true
parts:
- caption: A section
sections:
Expand Down
2 changes: 2 additions & 0 deletions tests/books/toc/_toc_simple.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
root: index
defaults:
titlesonly: true
sections:
- file: content1
- file: content2
2 changes: 2 additions & 0 deletions tests/books/toc/_toc_simple_changed.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
root: index
defaults:
titlesonly: true
sections:
- file: content2
- file: content1
2 changes: 2 additions & 0 deletions tests/books/toc/_toc_startwithlist.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
root: index
title: Toc
defaults:
titlesonly: true
sections:
- file: content1
title: Content1
Expand Down
2 changes: 2 additions & 0 deletions tests/books/toc/_toc_url.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
url: index
title: Toc
defaults:
titlesonly: true
sections:
- url: content1
title: Content1
Expand Down
2 changes: 2 additions & 0 deletions tests/books/toc/_toc_urllink.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
root: index
title: Toc
defaults:
titlesonly: true
sections:
- file: content1
- file: content2
Expand Down
2 changes: 2 additions & 0 deletions tests/books/toc/_toc_urlwithouttitle.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
root: index
title: Toc
defaults:
titlesonly: true
sections:
- url: http://somelink.com
title: Content1
Expand Down
2 changes: 2 additions & 0 deletions tests/books/toc/_toc_wrongkey.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
root: index
title: Toc
foo: bar
defaults:
titlesonly: true
sections:
- file: content1
title: Content1
Expand Down