Nummeriere alle Einträge im Übergabepaket in der Vorgangsreihenfolge.
Deploy Development / deploy (push) Successful in 27s
Test Suite / pytest-backend (push) Failing after 1m49s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 9s

Notizen, Dateien, E-Mails, Kapitel und Teilvorgänge erhalten dieselbe fortlaufende Nummerierung pro Ebene; der Eintragsordner trägt den Titel, der Inhalt liegt darin.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-18 14:50:07 +02:00
1 parent ea28c4f246
commit 97401a6d84
3 files changed
+98 -21

No files matched your search

+18 -12
View File
@@ -567,13 +567,16 @@ def _layout(root, chosen, loaded, notices, generated: str):
return
def emit(node: ExportNode, prefix: list[str]) -> None:
folders = [child for child in node.children if _is_folder(child) and _included(child, chosen)]
numbers = {child.id: index + 1 for index, child in enumerate(folders)}
numbered = _ordered_numbered_children(node, chosen)
numbers = {child.id: index + 1 for index, child in enumerate(numbered)}
for child in node.children:
if child.id in numbers:
folder = prefix + [_folder_name(child.title, numbers[child.id], prefix)]
if child.kind == "binding" and child.content_kind == "email":
_emit_email(child, folder, add, rewrite, entries, loaded, notice_for, generated, chosen)
if child.kind == "binding":
if child.content_kind == "email":
_emit_email(child, folder, add, rewrite, entries, loaded, notice_for, generated, chosen)
else:
_emit_loose(child, folder, add, entries, loaded, notice_for, generated, chosen)
else:
emit(child, folder)
else:
@@ -627,12 +630,8 @@ def _emit_loose(node, prefix, add, entries, loaded, notice_for, generated: str,
_emit_related(node, prefix, add, entries, loaded, notice_for, chosen, generated)
def _binding_bundle(prefix: list[str], host: ExportNode) -> list[str]:
"""One folder per entry; the main file and correspondence sit inside it."""
if host.kind == "binding" and host.content_kind == "email":
return list(prefix)
if host.kind == "binding":
return [*prefix, _segment(host.title)]
def _binding_bundle(prefix: list[str], _host: ExportNode) -> list[str]:
"""Main file and correspondence sit inside the numbered entry folder."""
return list(prefix)
@@ -1022,8 +1021,15 @@ def _annotation_filename(node: ExportNode, _prefix) -> str:
return f"{_segment(node.title)}.md"
def _is_folder(node: ExportNode) -> bool:
return node.kind in {"chapter", "matter"} or (node.kind == "binding" and node.content_kind == "email")
def _ordered_numbered_children(node: ExportNode, chosen: set[str]) -> list[ExportNode]:
"""Chapters, Teilvorgänge and every Schriftstück share one order within the parent."""
items: list[ExportNode] = []
for child in node.children:
if child.kind in {"chapter", "matter"} and _included(child, chosen):
items.append(child)
elif child.kind == "binding" and _included(child, chosen):
items.append(child)
return items
def _included(node: ExportNode, chosen: set[str]) -> bool: