mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -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 = []
|
families = []
|
||||||
current_family = ''
|
current_family = ''
|
||||||
def commit():
|
def commit():
|
||||||
families.append(current_family.strip())
|
val = current_family.strip()
|
||||||
|
if val:
|
||||||
|
families.append(val)
|
||||||
|
|
||||||
for token in tokenize_grouped(css_string.strip()):
|
for token in tokenize_grouped(css_string.strip()):
|
||||||
if token.type == 'STRING':
|
if token.type == 'STRING':
|
||||||
|
@ -42,6 +42,7 @@ class TestFonts3(BaseTest):
|
|||||||
r'"X \"Y"': ['X "Y'],
|
r'"X \"Y"': ['X "Y'],
|
||||||
'A B, C D, "E", serif': ['A B', 'C D', 'E', 'serif'],
|
'A B, C D, "E", serif': ['A B', 'C D', 'E', 'serif'],
|
||||||
'': [],
|
'': [],
|
||||||
|
'"", a': ['a'],
|
||||||
}.iteritems():
|
}.iteritems():
|
||||||
self.ae(q, parse_font_family(raw))
|
self.ae(q, parse_font_family(raw))
|
||||||
for single in ('serif', 'sans-serif', 'A B C'):
|
for single in ('serif', 'sans-serif', 'A B C'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user