case insensitive sorting of categories
This commit is contained in:
parent
50c394f33f
commit
d071c09822
|
@ -1154,7 +1154,7 @@ def generate(args):
|
|||
def make_categorization(categorization, query, work_filter, work_style_cards=False):
|
||||
categorization_dir = site_dir / categorization
|
||||
|
||||
cats = [cat for (cat,) in cur.execute(query)]
|
||||
cats = sorted((cat for (cat,) in cur.execute(query)), key=str.casefold)
|
||||
cat_samples = {}
|
||||
for cat in cats:
|
||||
cat_works = list(filter(work_filter(cat), works))
|
||||
|
@ -1183,22 +1183,22 @@ def generate(args):
|
|||
|
||||
make_categorization(
|
||||
'authors',
|
||||
'SELECT DISTINCT author FROM authors ORDER BY author',
|
||||
'SELECT DISTINCT author FROM authors',
|
||||
lambda author: lambda work: author in work['authors'],
|
||||
)
|
||||
make_categorization(
|
||||
'tags',
|
||||
'SELECT DISTINCT tag FROM tags ORDER BY tag',
|
||||
'SELECT DISTINCT tag FROM tags',
|
||||
lambda tag: lambda work: tag in work['tags'],
|
||||
)
|
||||
make_categorization(
|
||||
'circles',
|
||||
'SELECT DISTINCT circle FROM works WHERE circle NOT NULL ORDER BY circle',
|
||||
'SELECT DISTINCT circle FROM works WHERE circle NOT NULL',
|
||||
lambda circle: lambda work: work['circle'] == circle,
|
||||
)
|
||||
make_categorization(
|
||||
'series',
|
||||
'SELECT DISTINCT series FROM works WHERE series NOT NULL ORDER BY series',
|
||||
'SELECT DISTINCT series FROM works WHERE series NOT NULL',
|
||||
lambda series: lambda work: work['series'] == series,
|
||||
work_style_cards=True,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue