kanatype-insensitive sorting using Unicode Collation Algorithm

This commit is contained in:
xenofem 2024-04-02 14:24:42 -04:00
parent d071c09822
commit c4f5c776e2
3 changed files with 5 additions and 1 deletions

View file

@ -23,6 +23,7 @@ import fitz
from libsixel import *
from PIL import Image
from jinja2 import Environment, PackageLoader, select_autoescape
import pyuca
import rarfile
import requests
@ -1151,10 +1152,11 @@ def generate(args):
print(f'\x1b[2K\r{idx+1}/{len(works)} works processed...', end=('' if idx+1 < len(works) else '\n'))
uca = pyuca.Collator().sort_key
def make_categorization(categorization, query, work_filter, work_style_cards=False):
categorization_dir = site_dir / categorization
cats = sorted((cat for (cat,) in cur.execute(query)), key=str.casefold)
cats = sorted((cat for (cat,) in cur.execute(query)), key=uca)
cat_samples = {}
for cat in cats:
cat_works = list(filter(work_filter(cat), works))

View file

@ -60,6 +60,7 @@
setuptools
libsixel
(rarfile.override { useUnrar = true; })
pyuca
];
src = ./.;
};

View file

@ -13,6 +13,7 @@ dependencies = [
"importlib_resources",
"libsixel-python",
"rarfile",
"pyuca",
]
[project.scripts]