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

code simplification to remove the children_only parameter #174

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

chrispy-snps
Copy link
Collaborator

Implements a minor code change to remove the children_only parameter of the process_tag() function.

In actually, it already wasn't needed; the existing code would not find a convert_[document]() function and thus would apply no final formatting function anyway. This just makes the intended code path for BeautifulSoup objects a bit clearer in the comments.

@chrispy-snps chrispy-snps force-pushed the chrispy/remove-children-only-parameter branch from 57f5250 to 1c27253 Compare January 1, 2025 17:31
Copy link
Collaborator

@AlexVonB AlexVonB left a comment

Choose a reason for hiding this comment

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

Deleting code is my favorite code change! 🥳

Comment on lines +173 to +174
# apply this tag's final conversion function
# (BeautifulSoup objects have a name of "[document]" and will not apply one)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe the comment would be clearer for future reference if it read:

BeautifulSoup's special objects (e.g. the root object) have special names (like [document]) and do not match any convert_* functions. These objects therefore get skipped automatically by the next part.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm glad you mentioned this! If this suggestion in #136 is implemented, then indeed we could support final conversion functions on BeautifulSoup objects! This could be useful for inserting YAML metadata, or auto-applying a final cleanup via regex, and other fun things like that.

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