From c554c8cd4a2b603f4a97f50adf78bc82c5e74d9d Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 5 May 2026 10:13:15 +0200 Subject: fix: render and save list-typed frontmatter fields (categories) correctly FrontmatterEditor was only handling tags as a list; categories fell through to str(val) which produced Python repr output in the widget and wrote corrupted TOML strings on save. Extend display and save logic to all list-typed frontmatter fields generically. Also update TODO with new bugs and reorganise frontmatter section. Co-Authored-By: Claude Sonnet 4.6 --- ui/frontmatter_editor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ui/frontmatter_editor.py') diff --git a/ui/frontmatter_editor.py b/ui/frontmatter_editor.py index 6c53ac3..160536e 100644 --- a/ui/frontmatter_editor.py +++ b/ui/frontmatter_editor.py @@ -82,6 +82,9 @@ class FrontmatterEditor(QDialog): widget = QLineEdit(", ".join(str(v) for v in val) if isinstance(val, list) else str(val)) MultiTokenCompleter(known_tags, widget).attach(widget) self._fields[key] = widget + elif isinstance(val, list): + widget = QLineEdit(", ".join(str(v) for v in val)) + self._fields[key] = widget else: widget = QLineEdit(str(val)) self._fields[key] = widget @@ -104,7 +107,7 @@ class FrontmatterEditor(QDialog): updated[key] = widget.currentText() elif isinstance(widget, QLineEdit): val = widget.text().strip() - if key == "tags": + if isinstance(self._article.frontmatter.get(key), list): updated[key] = [t.strip() for t in val.split(",") if t.strip()] else: updated[key] = val -- cgit v1.2.3