kanatype-insensitive sorting using Unicode Collation Algorithm
This commit is contained in:
parent
d071c09822
commit
c4f5c776e2
|
@ -23,6 +23,7 @@ import fitz
|
||||||
from libsixel import *
|
from libsixel import *
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from jinja2 import Environment, PackageLoader, select_autoescape
|
from jinja2 import Environment, PackageLoader, select_autoescape
|
||||||
|
import pyuca
|
||||||
import rarfile
|
import rarfile
|
||||||
import requests
|
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'))
|
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):
|
def make_categorization(categorization, query, work_filter, work_style_cards=False):
|
||||||
categorization_dir = site_dir / categorization
|
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 = {}
|
cat_samples = {}
|
||||||
for cat in cats:
|
for cat in cats:
|
||||||
cat_works = list(filter(work_filter(cat), works))
|
cat_works = list(filter(work_filter(cat), works))
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
setuptools
|
setuptools
|
||||||
libsixel
|
libsixel
|
||||||
(rarfile.override { useUnrar = true; })
|
(rarfile.override { useUnrar = true; })
|
||||||
|
pyuca
|
||||||
];
|
];
|
||||||
src = ./.;
|
src = ./.;
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,6 +13,7 @@ dependencies = [
|
||||||
"importlib_resources",
|
"importlib_resources",
|
||||||
"libsixel-python",
|
"libsixel-python",
|
||||||
"rarfile",
|
"rarfile",
|
||||||
|
"pyuca",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
|
|
Loading…
Reference in a new issue