Alir3z4 / html2text

Convert HTML to Markdown-formatted text.
alir3z4.github.io/html2text/
GNU General Public License v3.0
1.74k stars 266 forks source link

Improve support for null atttibute values #406

Closed alexmv closed 5 months ago

alexmv commented 5 months ago

Rather than have these throw an assert at runtime, it is more useful to have them act as if the attribute did not exist.

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (7ba8431) 97.24% compared to head (3a37da4) 97.22%.

:exclamation: Current head 3a37da4 differs from pull request most recent head 66dd5ba. Consider uploading reports for the commit 66dd5ba to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #406 +/- ## ========================================== - Coverage 97.24% 97.22% -0.02% ========================================== Files 11 11 Lines 1124 1118 -6 ========================================== - Hits 1093 1087 -6 Misses 31 31 ``` | [Flag](https://app.codecov.io/gh/Alir3z4/html2text/pull/406/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alireza+Savand) | Coverage Δ | | |---|---|---| | [unittests-3.10](https://app.codecov.io/gh/Alir3z4/html2text/pull/406/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alireza+Savand) | `97.22% <100.00%> (-0.02%)` | :arrow_down: | | [unittests-3.11](https://app.codecov.io/gh/Alir3z4/html2text/pull/406/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alireza+Savand) | `97.22% <100.00%> (-0.02%)` | :arrow_down: | | [unittests-3.12](https://app.codecov.io/gh/Alir3z4/html2text/pull/406/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alireza+Savand) | `97.22% <100.00%> (-0.02%)` | :arrow_down: | | [unittests-3.8](https://app.codecov.io/gh/Alir3z4/html2text/pull/406/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alireza+Savand) | `97.22% <100.00%> (-0.02%)` | :arrow_down: | | [unittests-3.9](https://app.codecov.io/gh/Alir3z4/html2text/pull/406/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alireza+Savand) | `97.22% <100.00%> (-0.02%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Alireza+Savand#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Alir3z4 commented 5 months ago

@alexmv Thanks for the fix, it's a pretty good catch. I've left some comments, please let me know your feedback.

There are 2 files in conflicts as well as I've merged a big outstanding pull request https://github.com/Alir3z4/html2text/pull/392

alexmv commented 5 months ago

Rebased and repushed. As I commented above, the if "x" in thing and thing["x"] is not None pattern is apparently necessary for mypy type narrowing.

Alir3z4 commented 5 months ago

Thanks for the fix. In the coming days, I'll cut a release and the change will be available on PyPI.