Adjust logic for selecting top-level sections #72
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.
Hey team, this PR follows on #71, which I posted after trying to convert a bunch of notebook files where the section/chapter wrapper didn't match the pattern used in get_top_level_sections.
With this adjustment, in instances where a wrapper isn't found, the function will try to grab a list of top-level sections (currently we list all sections, I think). If there's more than one top-level section, the existing warning is logged; otherwise, we can proceed with processing the single top-level section.
Hopefully, most of the the time the notebooks we're working with will follow the expected form, but I've seen this week two patterns (albeit in the same project) that were well formed overall but not as expected:
PR includes a test case with data matching the former of the two above patterns. Let me know if you have feedback or want me to make any changes. Thanks!