From ab830bf7b489339d6d13ec673fd539a0023eb97d Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sun, 3 May 2026 15:44:00 +0200 Subject: feat: add Categories tab to TaxonomyView Single-list editor for docs/categories.txt with article usage counts scanned from frontmatter. Supports multi-select delete. Co-Authored-By: Claude Sonnet 4.6 --- core/taxonomy.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'core/taxonomy.py') diff --git a/core/taxonomy.py b/core/taxonomy.py index 8aee0aa..e72d486 100644 --- a/core/taxonomy.py +++ b/core/taxonomy.py @@ -22,3 +22,11 @@ def save_taxonomy(model: TaxonomyModel, it_path: Path, en_path: Path) -> None: pairs = sorted(model.it_to_en.items(), key=lambda x: x[0]) it_path.write_text("\n".join(k for k, _ in pairs) + "\n") en_path.write_text("\n".join(v for _, v in pairs) + "\n") + +def load_categories(path: Path) -> list[str]: + if not path.exists(): + return [] + return sorted(l.strip() for l in path.read_text().splitlines() if l.strip()) + +def save_categories(path: Path, categories: list[str]) -> None: + path.write_text("\n".join(sorted(categories)) + "\n") -- cgit v1.2.3