コード例 #1
0
ファイル: api_email.py プロジェクト: bcampbell/newscredit_api
	def ScrubHTMLGMail(self, body):
		#
		#	Scrub preamble postamble (i.e. On xxx so-and-so wrote:)
		#
		scrub_re = '<div>\s*<span class="gmail_quote">.*?</span>\s*' + re.escape(self.cfg_snip_html) + '\s*</div>'
		scrub_rex = re.compile(scrub_re, re.I|re.MULTILINE|re.DOTALL)

		body = scrub_rex.sub('', body)

		#
		#	GMail doesn't use proper blockquote
		#
		count = 0
		while body.find("""style="margin-left: 40px;">""") != -1 and count < 5:
			count += 1
			body = bm_text.snip_between(
				body, 
				start_re = """<(p|div) style="margin-left: 40px;">""",
				end_re = "</(p|div)>",
				replace_inner = None,
				replace_start = "<blockquote><p>",
				replace_end = "</p></blockquote>",
			)

		return	body
コード例 #2
0
ファイル: api_email.py プロジェクト: bcampbell/newscredit_api
	def ScrubHTMLOutlookExpress(self, body):
		body = bm_text.snip_between_tags(body, "div", replace_inner = None, replace_start = "<p>", replace_end = "</p>")
		body = bm_text.snip_between(body, 
			start_re = re.escape('<font face="Arial" size="2">'), 
			end_re = re.escape('</font>'), 
			replace_inner = None, replace_start = "", replace_end = "")
		return	body