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

The chapters are incorrectly numbered based on lexicographical ordering of the book part file names (Jupyter Book) #17

Open
So-Cool opened this issue Jan 10, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@So-Cool
Copy link

So-Cool commented Jan 10, 2021

Describe the bug

The following ToC

- file: intro

- part: b
  numbered: 2
  chapters:
  - file: chapter1
  - file: chapter2

- part: a
  numbered: 2
  chapters:
  - file: chapter3

always produces the correct chapter numbering:

Welcome to your Jupyter Book

B
1. ch1
2. ch2

A
3. ch3

However, when the parts are sourced from files the chapter numbering order depends on the lexicographical ordering of the book part file names, i.e.:

- file: intro

- part:
  numbered: 2
  file: a
  chapters:
  - file: chapter1
  - file: chapter2

- part:
  numbered: 2
  file: b
  chapters:
  - file: chapter3

give the correct numbering:

Welcome to your Jupyter Book

a
1. ch1
2. ch2

b
3. ch3

but

- file: intro

- part:
  numbered: 2
  file: b
  chapters:
  - file: chapter1
  - file: chapter2

- part:
  numbered: 2
  file: a
  chapters:
  - file: chapter3

reorders the numbering:

Welcome to your Jupyter Book

b
2. ch1
3. ch2

a
1. ch3

To Reproduce

  1. Build a Jupyter Book with the following _toc.yml:
    - file: intro
    
    - part:
      numbered: 2
      file: b
      chapters:
      - file: chapter1
      - file: chapter2
    
    - part:
      numbered: 2
      file: a
      chapters:
      - file: chapter3
    
    It is important to preserve the naming of the part files, i.e., a.md and b.md
  2. The chapter numbering sequence is determined by the lexicographical ordering of the book part file names

Expected behavior

The chapter numbering should be consistent with the order given in the _toc.yml file.

Environment

  • Python Version [e.g. 3.7.1]: 3.8.2
  • Package versions or output of jupyter-book --version: 0.1.2 (6683e3f)
  • Operating System: MacOS 10.15.6

Additional context

Jupyter Book: 0.9.1
MyST-NB: 0.10.1
Sphinx Book Theme: 0.0.39
MyST-Parser: 0.12.10
Jupyter-Cache: 0.4.1
NbClient: 0.5.1

Jupyter Book installed from the latest master branch commit (jupyter-book/jupyter-book@3845dd5)

@So-Cool So-Cool added the bug Something isn't working label Jan 10, 2021
@welcome
Copy link

welcome bot commented Jan 10, 2021

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@AakashGfude
Copy link
Member

uuu, This is interesting. Thanks for the bug @So-Cool. Will have a look at this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants