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

!!![FEATURE] add document iterator #682

Merged
merged 1 commit into from
Nov 21, 2023
Merged

Conversation

jaapio
Copy link
Member

@jaapio jaapio commented Nov 17, 2023

The newly added iterators do iterate the toc tree to find the order of rendering of documents. This is required to have single page outputs in the correct order. The downside of this new approach is that only documents that are in a toc-tree are rendered.

@jaapio
Copy link
Member Author

jaapio commented Nov 17, 2023

@linawolf can you confirm the new behavior is expected when using toc-trees and that we want to have it this way?

@linawolf
Copy link
Contributor

We would also have to render orphans that are not connected to the toctree. It is totally "legal" to have orphans. In the rendering I would attach all orphans to the end of their corresponding directory in alphabetical order if there is more then one. I would exclude them from rendering int the prev-next buttons (and maybe single HTML) however. We could the leave the responsibity of if they should be rendered or not to the renderer and only have something like an "Is orphan" check

In sphinx all orphans must have the :orphan: modifier at the top of the document or they cause a warning. In either case they are rendered and can be linked with :ref: and :doc: links or cannonical URLs

@jaapio jaapio force-pushed the feature/document-iterator branch 2 times, most recently from bb90c66 to 0adf582 Compare November 20, 2023 21:43
@jaapio
Copy link
Member Author

jaapio commented Nov 20, 2023

I have updated the iterator to ensure orphans are rendered, I use a weak map to track the rendered documents, every time we see a document the flag is set to false this has 2 effects, documents that are seen are not rendered a second time, and documents that are not seen will be rendered afterwards.

There is no option yet to render just the non-orphans, but I think this is easy to implement by adding a filter to the iterator that can be configured via the constructor of the iterator.

@jaapio jaapio marked this pull request as ready for review November 20, 2023 21:48
The newly added iterators do iterate the toc tree to find the order of rendering
of documents. This is required to have single page outputs in the correct order.
The downside of this new approach is that only documents that are in a toc-tree
are rendered.
@jaapio jaapio force-pushed the feature/document-iterator branch from 0adf582 to f72e199 Compare November 21, 2023 10:56
@jaapio jaapio merged commit 296c70b into main Nov 21, 2023
25 checks passed
@jaapio jaapio deleted the feature/document-iterator branch November 21, 2023 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants