From 493a068815c31a0bdd43ab83a2bd3883eb4cd816 Mon Sep 17 00:00:00 2001 From: viernullvier Date: Wed, 7 Oct 2015 17:44:06 +0200 Subject: [PATCH] Suppress base_url via attribute Don't prepend base_url to URLs if the tag's attribute 'data-premailer' is set to 'ignore' --- premailer/premailer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/premailer/premailer.py b/premailer/premailer.py index 76736b3..fe1852f 100644 --- a/premailer/premailer.py +++ b/premailer/premailer.py @@ -441,6 +441,8 @@ def transform(self, pretty_print=True, **kwargs): for item in page.xpath("//@%s" % attr): parent = item.getparent() url = parent.attrib[attr] + if parent.attrib.pop(self.attribute_name, None) == 'ignore': + continue if ( attr == 'href' and self.preserve_internal_links and url.startswith('#')