APD-363 - [BE] do not replace tel: links with base_url (#1) (#183)

* APD-363 - [BE] do not replace tel: links with base_url

* Correct typo

* Correct test html

* Correct description grammar
This commit is contained in:
Michal Proszek 2017-07-10 19:44:55 +02:00 committed by Serghei Mihai
parent 00dc70dbe2
commit 2a5b7e2aa3
2 changed files with 21 additions and 0 deletions

View File

@ -485,6 +485,8 @@ class Premailer(object):
url.startswith('cid:')
):
continue
if attr == 'href' and url.startswith('tel:'):
continue
parent.attrib[attr] = urljoin(self.base_url, url)
if hasattr(self.html, "getroottree"):

View File

@ -837,6 +837,25 @@ ical-align:middle" bgcolor="red" valign="middle">Cell 2</td>
compare_html(expect_html, result_html)
def test_tel_url(self):
"""if you use URL with tel: protocol, it should stay as tel:
when baseurl is used
"""
html = """<html>
<head>
<title>Title</title>
</head>
<body>
<a href="tel:202-555-0113">202-555-0113</a>
</body>
</html>"""
p = Premailer(html, base_url='http://kungfupeople.com')
result_html = p.transform()
compare_html(result_html, html)
def test_uppercase_margin(self):
"""Option to comply with outlook.com