-
Notifications
You must be signed in to change notification settings - Fork 286
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
Fix issue with emphasis and whitespace #177
Conversation
6698aaa
to
b2765e2
Compare
1 similar comment
ping @Alir3z4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, I have only small change request regarding the coding style that would be good to know what you think.
Also please add the changes to ChangeLog as well.
@@ -376,15 +381,38 @@ def handle_tag(self, tag, attrs, start): | |||
self.blockquote -= 1 | |||
self.p() | |||
|
|||
def no_preceding_space(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using an if condition here, could this be on-line like:
def no_preceding_space(self):
return self.preceding_data and re.match(r'[^\s]', self.preceding_data[-1])
In this way the function always returns a bool
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small docstring would be great, although it's not necessary. The function name speaks by itself.
Good function naming
html2text/__init__.py
Outdated
@@ -769,6 +797,19 @@ def o(self, data, puredata=0, force=0): | |||
self.outcount += 1 | |||
|
|||
def handle_data(self, data, entity_char=False): | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This blank line can be removed.
@jonathan-s Thanks** for the great work. |
a5b2824
to
5aa7c11
Compare
6 similar comments
@Alir3z4 All set! Tests are passing and I made the requested changes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work.
@jonathan-s Thanks, awesome work. |
This fixes some issues that occurs with white spaces around the following emphasis marks
~~
,**
,_
. It's not the most beautiful code, but it fixes the bugs.