mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Discard empty strings when parsing font-family
This commit is contained in:
parent
0643da49e0
commit
f1122ac05f
@ -15,7 +15,9 @@ def parse_font_family(css_string):
|
||||
families = []
|
||||
current_family = ''
|
||||
def commit():
|
||||
families.append(current_family.strip())
|
||||
val = current_family.strip()
|
||||
if val:
|
||||
families.append(val)
|
||||
|
||||
for token in tokenize_grouped(css_string.strip()):
|
||||
if token.type == 'STRING':
|
||||
|
@ -42,6 +42,7 @@ class TestFonts3(BaseTest):
|
||||
r'"X \"Y"': ['X "Y'],
|
||||
'A B, C D, "E", serif': ['A B', 'C D', 'E', 'serif'],
|
||||
'': [],
|
||||
'"", a': ['a'],
|
||||
}.iteritems():
|
||||
self.ae(q, parse_font_family(raw))
|
||||
for single in ('serif', 'sans-serif', 'A B C'):
|
||||
|
Loading…
x
Reference in New Issue
Block a user