Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. def _clean_emphasis_tags(self, text):
  2. touchups = [[re.compile(r'<i>\xa0'), ' <i>'],
  3. [re.compile(r'\xa0</i>'), '</i> '],
  4. [re.compile(r'<b>\xa0'), ' <b>'],
  5. [re.compile(r'\xa0</b>'), '</b> ']]
  6.  
  7. touched_up = text
  8. for touchup in touchups:
  9. touched_up = touchup[0].sub(touchup[1], touched_up)
  10.  
  11. return touched_up
  12.  
  13. def _html_to_markdown(self, text, as_body=False, upload_images=True):
  14. text = _clean_emphasis_tags(text)
  15.  
  16. if as_body:
  17. text = self.body_parser.parse(text, upload_images=upload_images)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement