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

Extra '\' slash appear before '-' and '.' #111

Open
Jerry-Ku opened this issue Sep 26, 2017 · 1 comment
Open

Extra '\' slash appear before '-' and '.' #111

Jerry-Ku opened this issue Sep 26, 2017 · 1 comment

Comments

@Jerry-Ku
Copy link

Jerry-Ku commented Sep 26, 2017

Extra slash was added in front of output when two and above '-' were encountered. eg.
echo '<p>-</p> | html2text -> '-'
echo '<p>--</p> | html2text -> '\--'
Also, if the input string format is '[0-9].[space]', the output will be '[0-9]. ', eg.
echo '<p>.</p> -> '.'
echo '<p>..</p> -> '..'
echo '<p>2.</p> -> '2.'
echo '<p>2. </p> -> '2\. '
echo '<p>a. </p> -> 'a. '

@bubalopetar
Copy link

bubalopetar commented Dec 16, 2021

Issue happens at utils.py package file (Python37\Lib\site-packages\html2text\utils.py) at lines 210, 211, 212.
Here are those lines that work:
text = config.RE_MD_DOT_MATCHER.sub(r"\1\2", text)
text = config.RE_MD_PLUS_MATCHER.sub(r"\1\2", text)
text = config.RE_MD_DASH_MATCHER.sub(r"\1\2", text)

These lines originally have 2 extra backslashes, just replacing these 3 lines should fix this issue. Not sure if it could break something else.

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

No branches or pull requests

2 participants