Make the prefixed classes utility function available

This commit is contained in:
Kovid Goyal 2020-10-11 13:01:32 +05:30
parent 77e14bff20
commit 46684e5376
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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