-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Implement sequential numbering for multiple toctrees #4733
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4733 +/- ##
==========================================
+ Coverage 83.29% 83.29% +<.01%
==========================================
Files 293 293
Lines 39218 39238 +20
Branches 5863 5865 +2
==========================================
+ Hits 32665 32685 +20
Misses 5197 5197
Partials 1356 1356
Continue to review full report at Codecov.
|
|
Regarding the By the way for better parallel with html builds, perhaps LaTeX should not number the parts, i.e. use |
|
One minor question, does it interact properly with toctree captions? I assume it works, however the added docs use headings, while I've used captions in the past for parts of a book. Thanks again. |
|
@mixmastamyk - yes, captions work properly. The |
|
I've updated the pull request to resolve conflicts with upstream. Hopefully this will facilitate review and acceptance. |
1 similar comment
|
Sorry for very late response. We have to design whole of ToC. I can't say what way is better to define better ToC (inc. appendix, indices and so on). At least, ToC settings and mark-ups should effect to all of HTML, EPUB and PDF (LaTeX) documents. So we need to update this before merging if we choose this way. |
|
As the extension merely changes the chapter numbers, I'd be surprised it didn't work with other output formats. Is that the case? Has someone tested it and found that not to be working? |
|
@tk0miya I agree with the need to consider the ToC in an integrated sense. In this case, however, it is entirely up to the user if they want to start numbering at a point other than 1. This PR helps them do that. Thanks! |
|
Thanks, I guess the question is….
If the second, support could be tracked and worked on in separate issues and timeframes. |
No, this is not a bug. I think this PR introduces a new feature; "part like" sectioning. But this PR is only available for HTML output. So I think this PR should also add the feature to LaTeX builder. Note: This is not main reason why I'm not merging this now. As I commented above, we have to re-design ToC model of Sphinx. I can't say |
|
It does feel like a design flaw that some builders don't pick up chapter numbers, it means their mechanisms must differ somehow, perhaps numbering needs to be moved up into a parent class. From the user interface/markup perspective, perhaps a If you need someone to give feedback, I'm available. Where could we go to confer? |
My understanding is that it is due to a lack of support in non-html builders. Up until now, it's only been by coincidence that they match. All this PR does is modify the Even though I numbered the "Parts" in the test case (as "Part I" and "Part II"), don't assume those necessarily carry any numeric meaning. For example, the part headings could be "Prologue", "Statics", "Dynamics", "Glossary", "Index", and "Epilogue". Maybe only "Statics" and "Dynamics" should be numbered sequentially (with |
|
Ok, thanks. Wouldn't a |
It would be nice if this PR was used as input for a larger discussion of how toctree is used, see e.g. #4133 about more generic numbering (and lettering) of sections |
@jessetan, I agree. However I would like to see this PR merged first. Then, we could take the numeric secnumber list (was tuple) that is generated and transform it by a custom function into any complex numbering format that is desired (numeric, alphabetic, roman, etc.). Right now, that "function" is simply |
|
It's unclear to me if this is implemented or not - is it? I see that @thfanning closed the issue in a commit but I'm not sure how we can trigger this behavior if we wish |
|
No, it continues to be ignored. |
|
I did not intend to close this pull request. We needed to update our internal implementation, but my master branch was so far out of sync with upstream that it was a mess. So I had to force my own master to update. My apologies for not realizing the impact. Honestly, I'm a wiz at Subversion but suck with git. For my current implementation, see thfanning/sphinx@c2ed5bb. Unfortunately the current branch includes a tweak to equation numbering as well, but the TOC issue is trivial to implement. |
|
Maybe @tk0miya could re-open this? I think the issue is an important one because (to my knowledge) this makes sub-sections not have unique numbers (because you'll have a section in two different chapters, each called |
|
Unfortunately, I also can't reopen. |


Subject: Implement sequential numbering for multiple toctrees in the same document.
Feature or Bugfix
Purpose
Multiple, numbered toctrees in the same document normally start with 1. This simple update allows authors to sequentially number multiple toctrees in the same document, or to specify a specific starting number.
Detail
Multiple toctrees of the form
will result with the heading of
bazbeing numbered as 3. Starting a toctree at a specific number is also possible by giving a positive value as a numeric argument tocontinue.A test case is provided, and a unit test is included to verify behavior. The Sphinx documentation has also been updated.
I have only been able to test this with the html builder, but am interested in feedback.
Relates