Skip to content

Convert keyword elements correctly #61

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

Merged
merged 8 commits into from
Oct 24, 2024

Conversation

MattiasRosell
Copy link

@MattiasRosell MattiasRosell commented Sep 25, 2024

I noticed that the <del> tag was not converted into htpy's del_ correctly. The formatters also can not handle importing python's del keyword and would crash. Ruff would not output anything while Black would output the unformatted code.

I fixed these issues by:

  • Replacing div with div_ when converting html using html2htpy.
  • Adding a test checking that div is successfully converted to div_.
  • Adding consistent behaviour between Ruff and Black when the input can not be formatted.

@pelme then found out that htpy did not convert the del_ element to html correctly. So we fixed that as well.

  • Fix the del_ element not converting into <del> correctly.
  • Only remove underscore from elements named after Python's keywords.

@MattiasRosell MattiasRosell changed the title Convert del tags to htpy's del_ element in html2htpy Correctly convert <dev> tags to htpy's del_ element Sep 25, 2024
Copy link
Owner

@pelme pelme left a comment

Choose a reason for hiding this comment

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

praise: very nice, fixing annoyances in html2htpy is really helpful and makes it nicer to use!

@MattiasRosell MattiasRosell changed the title Correctly convert <dev> tags to htpy's del_ element Convert keyword elements correctly Sep 26, 2024
@MattiasRosell MattiasRosell requested a review from pelme September 26, 2024 09:25
@MattiasRosell MattiasRosell force-pushed the fix-html2htpy-del-tag-bug branch from bd18b5c to 3c75efe Compare October 24, 2024 07:15
Copy link
Author

@MattiasRosell MattiasRosell left a comment

Choose a reason for hiding this comment

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

Updated branch to fix conflicts

Copy link
Owner

@pelme pelme left a comment

Choose a reason for hiding this comment

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

praise: very nice, having a html2htpy that works reliable is nice!

@MattiasRosell MattiasRosell requested a review from pelme October 24, 2024 09:16
@pelme pelme merged commit c2bff6c into pelme:main Oct 24, 2024
13 checks passed
@MattiasRosell MattiasRosell deleted the fix-html2htpy-del-tag-bug branch October 25, 2024 06:27
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