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

for convert_* functions, allow for tags with special characters in their name (like "subtag-name") #136

Merged
merged 2 commits into from
Jan 19, 2025

Conversation

Fess-AKA-DeadMonk
Copy link
Contributor

html tags may contain symbols like : and - which are not suitable for the python function names
simple name converter allows usage of the methods for tags like tag:subtag-name

@chrispy-snps
Copy link
Collaborator

chrispy-snps commented Jan 1, 2025

@Fess-AKA-DeadMonk - thanks for submitting this pull request!

I have two suggestions:

  1. Include [ and ] in the translation set (as BeautifulSoup objects have a name value of [document], and this would enable the creation of soup-level conversion functions).

  2. Move the creation of the translation dictionary to be a global value so it is only computed once:

    tag_name_translation = ''.maketrans(':-[]', '____')
    

@chrispy-snps
Copy link
Collaborator

@Fess-AKA-DeadMonk - if you are able to make the changes suggested above, we can review and approve this pull request. Thanks!

@chrispy-snps chrispy-snps changed the title fixed the way the converter is chosen for tags with names containing symbols not suitable for python def for convert_* functions, allow for tags with special characters in their name (like "subtag-name") Jan 19, 2025
…symbols not suitable for python def

html tags may contain symbols like `:` and `-` which are not suitable for the python function names
simple name converter allows usage of the methods for tags like `tag:subtag-name`
@chrispy-snps chrispy-snps force-pushed the develop branch 2 times, most recently from a2f4c3b to bd4c46d Compare January 19, 2025 14:13
Signed-off-by: chrispy <[email protected]>
@chrispy-snps chrispy-snps merged commit 1b33330 into matthewwithanm:develop Jan 19, 2025
1 check passed
@chrispy-snps
Copy link
Collaborator

@Fess-AKA-DeadMonk - the support for BeautifulSoup objects is best left to #174, so I added a unit test and merged your branch. Thanks for your contribution!

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