mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make the prefixed classes utility function available
This commit is contained in:
parent
77e14bff20
commit
46684e5376
@ -39,6 +39,19 @@ def classes(classes):
|
|||||||
'class': lambda x: x and frozenset(x.split()).intersection(q)})
|
'class': lambda x: x and frozenset(x.split()).intersection(q)})
|
||||||
|
|
||||||
|
|
||||||
|
def prefixed_classes(classes):
|
||||||
|
q = frozenset(classes.split(' '))
|
||||||
|
|
||||||
|
def matcher(x):
|
||||||
|
if x:
|
||||||
|
for candidate in frozenset(x.split()):
|
||||||
|
for x in q:
|
||||||
|
if candidate.startswith(x):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
return {'attrs': {'class': matcher}}
|
||||||
|
|
||||||
|
|
||||||
class LoginFailed(ValueError):
|
class LoginFailed(ValueError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user