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

Adjust logic for selecting top-level sections #72

Merged
merged 2 commits into from
Feb 13, 2025
Merged

Conversation

ghyman-oreilly
Copy link
Collaborator

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:

  • article wrapper is present but has no role attribute
  • wrapper with role of main has tag type of main rather than article

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!

@ghyman-oreilly ghyman-oreilly requested a review from a team as a code owner February 13, 2025 20:21
Copy link
Contributor

@delfanbaum delfanbaum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Looks good, thanks for including what edge cases the test is looking at in the docstring (since it's a pain to always go digging through the HTML).

@ghyman-oreilly ghyman-oreilly merged commit 07b81ee into main Feb 13, 2025
2 checks passed
@ghyman-oreilly ghyman-oreilly deleted the dev021124_2 branch February 13, 2025 20:54
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