|
@@ -24,11 +24,12 @@ BS_HTML_BODY_PARSE_CONFIG = {
|
24
|
24
|
'tag_blacklist': ["script", "style", "blockquote"],
|
25
|
25
|
'class_blacklist': ['moz-cite-prefix'],
|
26
|
26
|
'tag_whitelist': ['a', 'b', 'strong', 'i', 'br', 'ul', 'li', 'ol',
|
27
|
|
- 'em','i', 'u',
|
28
|
|
- 'thead', 'tr', 'td','tbody', 'table', 'p', 'pre'],
|
29
|
|
- 'attrs_whitelist' : ['href']
|
|
27
|
+ 'em', 'i', 'u',
|
|
28
|
+ 'thead', 'tr', 'td', 'tbody', 'table', 'p', 'pre'],
|
|
29
|
+ 'attrs_whitelist': ['href'],
|
30
|
30
|
}
|
31
|
31
|
|
|
32
|
+
|
32
|
33
|
class DecodedMail(object):
|
33
|
34
|
|
34
|
35
|
def __init__(self, message: Message):
|
|
@@ -75,15 +76,14 @@ class DecodedMail(object):
|
75
|
76
|
return body
|
76
|
77
|
|
77
|
78
|
@staticmethod
|
78
|
|
- def _parse_txt_body(txt_body:str):
|
|
79
|
+ def _parse_txt_body(txt_body: str):
|
79
|
80
|
txt_body = EmailReplyParser.parse_reply(txt_body)
|
80
|
81
|
html_body = markdown.markdown(txt_body)
|
81
|
82
|
body = DecodedMail._parse_html_body(html_body)
|
82
|
83
|
return body
|
83
|
84
|
|
84
|
85
|
@staticmethod
|
85
|
|
- def _parse_html_body(html_body:str):
|
86
|
|
-
|
|
86
|
+ def _parse_html_body(html_body: str):
|
87
|
87
|
soup = BeautifulSoup(html_body)
|
88
|
88
|
config = BS_HTML_BODY_PARSE_CONFIG
|
89
|
89
|
for tag in soup.findAll():
|