diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c1e62c..2265b21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ 0.10.0 (?) ------------------ +- fix CSS child selectors +- disable loading remote stylesheets - require css-inline 0.11.x for performance improvements - drop css-inline Python 3.6 support - fix exception when processing an `mj-section` with `background-size` (reported by Thomas Handorf) diff --git a/mjml/mjml2html.py b/mjml/mjml2html.py index 029e808..437b75e 100644 --- a/mjml/mjml2html.py +++ b/mjml/mjml2html.py @@ -115,7 +115,7 @@ def parse(_mjml, parentMjClass='', *, template_dir): classes = ignore_empty(attributes.get('mj-class', '').split(' ')) # upstream parses text contents (+ comments) in mjml-parser-xml/index.js - content = _mjml.decode_contents() + content = _mjml.decode_contents(formatter=None) attributesClasses = {} for css_class in classes: @@ -212,7 +212,7 @@ def _head_data_add(attr, *params): for element in contentSoup.select(selector): element[attrName] = value or '' - content = contentSoup.decode_contents() + content = contentSoup.decode_contents(formatter=None) content = skeleton( content=content, @@ -235,6 +235,7 @@ def _head_data_add(attr, *params): inline_style_tags=False, keep_link_tags=True, keep_style_tags=True, + load_remote_stylesheets=False, ) content = inliner.inline(content) diff --git a/tests/testdata/css-inlining-expected.html b/tests/testdata/css-inlining-expected.html index 39ce267..0085077 100644 --- a/tests/testdata/css-inlining-expected.html +++ b/tests/testdata/css-inlining-expected.html @@ -124,7 +124,7 @@ -
Hello World
+
< Hello World >
diff --git a/tests/testdata/css-inlining.mjml b/tests/testdata/css-inlining.mjml index 538a0eb..f7fcf06 100644 --- a/tests/testdata/css-inlining.mjml +++ b/tests/testdata/css-inlining.mjml @@ -4,6 +4,9 @@ .box { border: 5px solid red; } + .box > div > span { + border: 3px solid blue; + } @@ -14,7 +17,11 @@ - Hello World + + + < Hello World > + +