This commit is contained in:
team3
2026-06-21 18:32:55 +02:00
parent 3965bc5bf9
commit befd509c08
15 changed files with 1315 additions and 12 deletions

View File

@@ -187,6 +187,24 @@ def _parse_fragment(text: str) -> list[dict]:
return sections
_GRAFIK_MERMAID_RE = re.compile(r"```(?:mermaid)?\s*\n(.*?)```", re.DOTALL)
def _parse_grafik(text: str) -> dict[str, str]:
"""Grafik-Datei → {section-titel: mermaid-code}. Je `<!-- section: titel -->` den ersten
```mermaid…```-Block (sonst den Rohtext des Abschnitts)."""
out: dict[str, str] = {}
parts = re.split(r"<!--\s*section\s*:\s*(.*?)\s*-->", text, flags=re.IGNORECASE)
for i in range(1, len(parts), 2):
titel = parts[i].strip()
body = parts[i + 1] if i + 1 < len(parts) else ""
m = _GRAFIK_MERMAID_RE.search(body)
code = (m.group(1) if m else body).strip()
if titel and code:
out[titel] = code
return out
def _parse_subbausteine(text: str) -> dict[str, list[str]]:
"""Parst eine Subbaustein-Datei → {Baustein-Titel: [Subbaustein, …]} in Reihenfolge.