fix: reweave regex fallback uses consistent YAML list format
The regex fallback was writing list entries as ' - "title"' (2-space indent + quotes) while existing frontmatter uses '- title' (0-space indent, no quotes). This caused YAML parse failures during merge. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a68f38609d
commit
8f6057686e
1 changed files with 4 additions and 4 deletions
|
|
@ -535,8 +535,8 @@ def _write_edge_regex(neighbor_path: Path, fm_text: str, body_text: str,
|
|||
field_re = re.compile(rf"^{edge_type}:\s*$", re.MULTILINE)
|
||||
inline_re = re.compile(rf'^{edge_type}:\s*\[', re.MULTILINE)
|
||||
|
||||
entry_line = f' - "{orphan_title}"'
|
||||
rw_line = f' - "{orphan_title}|{edge_type}|{date_str}"'
|
||||
entry_line = f'- {orphan_title}'
|
||||
rw_line = f'- {orphan_title}|{edge_type}|{date_str}'
|
||||
|
||||
if field_re.search(fm_text):
|
||||
# Multi-line list exists — find end of list, append
|
||||
|
|
@ -548,7 +548,7 @@ def _write_edge_regex(neighbor_path: Path, fm_text: str, body_text: str,
|
|||
new_lines.append(line)
|
||||
if re.match(rf"^{edge_type}:\s*$", line):
|
||||
in_field = True
|
||||
elif in_field and not line.startswith(" -"):
|
||||
elif in_field and not line.startswith(("- ", " -")):
|
||||
# End of list — insert before this line
|
||||
new_lines.insert(-1, entry_line)
|
||||
in_field = False
|
||||
|
|
@ -576,7 +576,7 @@ def _write_edge_regex(neighbor_path: Path, fm_text: str, body_text: str,
|
|||
new_lines.append(line)
|
||||
if re.match(r"^reweave_edges:\s*$", line):
|
||||
in_rw = True
|
||||
elif in_rw and not line.startswith(" -"):
|
||||
elif in_rw and not line.startswith(("- ", " -")):
|
||||
new_lines.insert(-1, rw_line)
|
||||
in_rw = False
|
||||
inserted_rw = True
|
||||
|
|
|
|||
Loading…
Reference in a new issue