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

[Bug]: Can't handle comments #28

Closed
3 tasks done
matthewdeanmartin opened this issue Jun 4, 2023 · 2 comments
Closed
3 tasks done

[Bug]: Can't handle comments #28

matthewdeanmartin opened this issue Jun 4, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@matthewdeanmartin
Copy link

Prerequisites

  • I have searched the issues and believe that it has not already been reported
  • I have made sure this bug reproduces on the latest version
  • I agree to follow the Code of Conduct

Bug description

It should be able to handle HTML comments

Reproduction steps

This

import unmarkd
result_md = unmarkd.unmark("<!-- first a comment-->")
print(result_md)

blows up like this

E:\.virtualenv\markdown_build-ameLEfbe\Scripts\python.exe E:\github\markdown_build\conversoins.py 
Traceback (most recent call last):
  File "E:\github\markdown_build\conversoins.py", line 5, in <module>
    result_md = unmarkd.unmark("<!-- first a comment-->")
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\.virtualenv\markdown_build-ameLEfbe\Lib\site-packages\unmarkd\__init__.py", line 11, in unmark
    return unmarkers.BasicUnmarker().unmark(html)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\.virtualenv\markdown_build-ameLEfbe\Lib\site-packages\unmarkd\unmarkers.py", line 223, in unmark
    return self.__parse(html).strip().replace("\u0000", "\uFFFD")
           ^^^^^^^^^^^^^^^^^^
  File "E:\.virtualenv\markdown_build-ameLEfbe\Lib\site-packages\unmarkd\unmarkers.py", line 118, in __parse
    output += self.resolve_handler_func(name)(child)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\.virtualenv\markdown_build-ameLEfbe\Lib\site-packages\unmarkd\unmarkers.py", line 93, in resolve_handler_func
    return getattr(self, "tag_" + name)
                         ~~~~~~~^~~~~~
TypeError: can only concatenate str (not "NoneType") to str

Other information

python 3.11
beautifulsoup4==4.12.2

Reproduces how often

I can reproduce this bug 100% of the time

@matthewdeanmartin matthewdeanmartin added the bug Something isn't working label Jun 4, 2023
@ThatXliner
Copy link
Owner

Nice catch!

@ThatXliner
Copy link
Owner

ThatXliner commented Jun 7, 2023

When I was fixing this, I found out that I should really update the old codebase. I've dropped Python 3.6 support (which had reached its EOL a long time ago) and Python 3.7 support (which is reaching its end of life in 2 weeks as of this comment)1. Since dropping Python versions is a breaking change, I've incremented the major semver number. I will release soon

Footnotes

  1. https://endoflife.date/python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants