summaryrefslogtreecommitdiffstats
path: root/ui/frontmatter_editor.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-05-05 10:13:15 +0200
committerDanilo M. <danix@danix.xyz>2026-05-05 10:13:15 +0200
commitc554c8cd4a2b603f4a97f50adf78bc82c5e74d9d (patch)
treec95d388711c1799ae1afa84d20757bfcb96dbd07 /ui/frontmatter_editor.py
parentc83dbcb2401b9d599ae9ceddcb4c88eb49a9b1aa (diff)
downloadpublisher-c554c8cd4a2b603f4a97f50adf78bc82c5e74d9d.tar.gz
publisher-c554c8cd4a2b603f4a97f50adf78bc82c5e74d9d.zip
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 <noreply@anthropic.com>
Diffstat (limited to 'ui/frontmatter_editor.py')
-rw-r--r--ui/frontmatter_editor.py5
1 files changed, 4 insertions, 1 deletions
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