tools: Export - include "all" wählt die ganze KB, index: true schreibt index.md und INDEX.md in den Zielordner (#217); 10.1.0-beta.21
CI / verify (push) Successful in 8m17s
CI / pwsh (push) Successful in 2m54s
Release / converters (push) Successful in 28s
Release / release (push) Successful in 36s
Release / wiki-mirror (push) Skipped

Files changed:
- CHANGES.md
- VERSION
- docs/how-to/export-to-a-synced-folder.md
- docs/reference/commands/exports.md
- docs/reference/configuration.md
- raw/CONTRACT.md
- tools/CONTRACT.md
- tools/README.md
- tools/chemenu/catalog.py
- tools/chemenu/commands/export_cmd.py
- tools/chemenu/commands/index_build.py
- tools/chemenu/config_shapes.py
- tools/chemenu/export_index.py
- tools/chemenu/guideline_export.py
- tools/chemenu/page_export.py
- tools/chemenu/tests/test_config_shapes.py
- tools/chemenu/tests/test_export_run.py
- tools/chemenu/tests/test_index_build.py

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SnAJ7Z3CpVD3PRbN73QtU2
This commit is contained in:
torbenandClaude Sonnet 5.5 committed 2026-10-16 15:44:21 +02:00
1 parent cc990dc89e
commit db09e89223
18 files changed
+693 -101

No files matched your search

+24 -1
View File
@@ -15,6 +15,7 @@ looks like* - the tables, the map, the shard files - stays in
"""
from __future__ import annotations
import re
from dataclasses import dataclass, field
from pathlib import Path
@@ -27,11 +28,33 @@ from chemenu.type_resolver import resolver
# number so growth is handled by arithmetic rather than by a judgment call.
SHARD_THRESHOLD = 50
# The name `group_pages` gives the pseudo-collection of pages sitting directly
# under `kb/`, which no collection directory holds.
ROOT_COLLECTION = "(kb root)"
# Display title for pages sitting directly in a collection root rather than in
# an area subdirectory.
UNGROUPED_TITLE = "All"
def anchor(title: str) -> str:
"""GitHub-style heading anchor, so a map can deep-link into a shard.
`\\w` rather than `a-z0-9`, which is not cosmetic: an area title follows the
KB language, and the first non-English one (`Abläufe`) had its umlaut
*deleted* rather than kept, so the map linked at `#ablufe` and the anchor it
was aiming at was `#abläufe`. Every deep link into a shard whose title
carries a non-ASCII letter was silently dead. Nothing surfaced it while the
only areas were entity ones, whose titles happen to be ASCII throughout.
"""
slug = re.sub(r"[^\w\s-]", "", title.lower(), flags=re.UNICODE)
return re.sub(r"\s+", "-", slug.strip())
def type_label(page: Page) -> str:
return page.subtype or page.kind or "unknown"
@dataclass
class Area:
"""One grouping inside a collection: a subdirectory, or the collection root
@@ -115,7 +138,7 @@ def group_pages(kb_dir: Path, pages: dict[str, Page]) -> list[Collection]:
except ValueError: # pragma: no cover - pages always live under kb_dir
continue
if len(parts) < 2:
collection_name, area_name = "(kb root)", ""
collection_name, area_name = ROOT_COLLECTION, ""
else:
collection_name = parts[0]
area_name = parts[1] if len(parts) > 2 else ""