From 294bdf3df071591315b6117fb6755f82d62b2aaa Mon Sep 17 00:00:00 2001 From: zhyq0826 Date: Wed, 25 Jan 2017 15:10:16 +0800 Subject: [PATCH] fix #5 --- markdown_css/__init__.py | 8 ++++++++ themes/style.css | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/markdown_css/__init__.py b/markdown_css/__init__.py index b3981ea..49661bc 100644 --- a/markdown_css/__init__.py +++ b/markdown_css/__init__.py @@ -18,6 +18,8 @@ import logging from collections import defaultdict from cssutils import CSSParser +from cssutils.css import CSSComment + # version is a human-readable version number. @@ -52,6 +54,9 @@ def parse_style(cssText): # init all selector for r in cssStyle: + if isinstance(r, CSSComment): + continue + # skip * selector if r.selectorText.find('*') >= 0: continue @@ -69,6 +74,9 @@ def append_all_selector(style): element_list = [] for r in cssStyle: + if isinstance(r, CSSComment): + continue + if r.selectorText.find('*') >= 0 and r.selectorText.find(':') < 0: append_all_selector(to_inline_style(r.style)) continue diff --git a/themes/style.css b/themes/style.css index 3e9ae15..0e1010a 100644 --- a/themes/style.css +++ b/themes/style.css @@ -2,6 +2,7 @@ color:#3e3e3e; } +/*comment*/ p{ letter-spacing: 1px !important; line-height: 1.7 !important; @@ -85,4 +86,4 @@ hr { pre { background: #f2f2f2 !important; padding: 12px 13px; -} \ No newline at end of file +}