diff options
| author | Danilo M. <danix@danix.xyz> | 2026-05-03 16:14:09 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-05-03 16:14:09 +0200 |
| commit | fb2aa9b6520eebba00f8da88a37ce5723a5c887f (patch) | |
| tree | b9533c61992ced8fce6b4d87ca50b939a3b05114 /ui/frontmatter_editor.py | |
| parent | 2319a6bf3c32407d387c45a522f20e23b7ba885f (diff) | |
| download | publisher-fb2aa9b6520eebba00f8da88a37ce5723a5c887f.tar.gz publisher-fb2aa9b6520eebba00f8da88a37ce5723a5c887f.zip | |
fix: preserve article body when saving frontmatter
FrontmatterEditor._save was passing empty string as body to
write_frontmatter, erasing all content below the +++ delimiter.
Now reads body via parse_frontmatter before writing back.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'ui/frontmatter_editor.py')
| -rw-r--r-- | ui/frontmatter_editor.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ui/frontmatter_editor.py b/ui/frontmatter_editor.py index ce70355..6c53ac3 100644 --- a/ui/frontmatter_editor.py +++ b/ui/frontmatter_editor.py @@ -7,7 +7,7 @@ from PyQt6.QtWidgets import ( from PyQt6.QtCore import Qt from pathlib import Path from core.models import Article, ARTICLE_TYPES -from core.frontmatter import write_frontmatter +from core.frontmatter import parse_frontmatter, write_frontmatter from core.taxonomy import load_taxonomy class MultiTokenCompleter(QCompleter): @@ -109,7 +109,8 @@ class FrontmatterEditor(QDialog): else: updated[key] = val try: - write_frontmatter(self._article.path, updated, "") + _, body = parse_frontmatter(self._article.path) + write_frontmatter(self._article.path, updated, body) self._article.frontmatter.update(updated) self.accept() except Exception as e: |
