summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-05-03 15:44:00 +0200
committerDanilo M. <danix@danix.xyz>2026-05-03 15:44:00 +0200
commitab830bf7b489339d6d13ec673fd539a0023eb97d (patch)
treea5874da620fcbb68b551b183dd450912084d00d2 /core
parent273915dafd51c0ef7aa1ac3f74cb6192497b9b09 (diff)
downloadpublisher-ab830bf7b489339d6d13ec673fd539a0023eb97d.tar.gz
publisher-ab830bf7b489339d6d13ec673fd539a0023eb97d.zip
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 <noreply@anthropic.com>
Diffstat (limited to 'core')
-rw-r--r--core/taxonomy.py8
1 files changed, 8 insertions, 0 deletions
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")