Rework parsing logic inside nbdev_sidebar
& Auto-add index file onto section
#1307
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why?
#1300 found an issue on
nbdev_sidebar
being unable to handle multi-level project structure properly (in a way that you think it should do).Summary
This PR should now handle multi-level structure project correctly.
Additionally,
nbdev_sidebar
now auto-detect the index file and added them tosection
.TL;DR:
href:/path/to/index
manually if there is an index file in the directory.Proposed change
files
were parsed into a directory structure as adict
then converted into a quarto format by_recursive_parser
and dumped to yaml usingyaml.dump
.IndentDumper
class were added to correct weirdPyYAML
indentation style that is not consistent with previous version ofsidebar.yaml
.href
manually, any properindex\.*
will be added to the section ashref: /path/to/index
automatically. This behavior is controlled by_recursive_parser(..., set_index: bool = True)
.