From 761f8cee245d9dabda538e752e9add576ea1f0c5 Mon Sep 17 00:00:00 2001 From: Daniel Kimsey Date: Tue, 12 May 2020 15:11:49 -0500 Subject: [PATCH] Ignore CSS declaration with empty content attribute I ran into an issue where the CSS parsing would break when the content attribute was empty. This change will make those declaration NOOPs and skip them. Example erroring declaration: ``` .fa-borders:before{ content:""; border: #000000 1px solid; padding:1px; border-radius:3px; font-size:95%; width:16px; height:16px; display:block } ``` --- icon_font_to_png/icon_font.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/icon_font_to_png/icon_font.py b/icon_font_to_png/icon_font.py index d0eadf8..e94ea50 100644 --- a/icon_font_to_png/icon_font.py +++ b/icon_font_to_png/icon_font.py @@ -60,6 +60,8 @@ def load_css(self): # Strip quotation marks if re.match("^['\"].*['\"]$", val): val = val[1:-1] + if val[1:] == "": + continue icons[name] = unichr(int(val[1:], 16)) common_prefix = common_prefix or ''