fix: Migration 022 — Regex an echte Template-Struktur angepasst (bold-headings)
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 36s
CI / test-python-backend-compliance (push) Successful in 32s
CI / test-python-document-crawler (push) Successful in 23s
CI / test-python-dsms-gateway (push) Successful in 19s
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 36s
CI / test-python-backend-compliance (push) Successful in 32s
CI / test-python-document-crawler (push) Successful in 23s
CI / test-python-dsms-gateway (push) Successful in 19s
This commit is contained in:
@@ -67,21 +67,32 @@ def wrap_block(content: str, block_id: str, pattern: str, flags: int = re.MULTIL
|
|||||||
# ─────────────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
def apply_nda_penalty_block(content: str) -> tuple[str, int]:
|
def apply_nda_penalty_block(content: str) -> tuple[str, int]:
|
||||||
"""Wraps the Vertragsstrafe section in NDA templates."""
|
"""Wraps the Vertragsstrafe section in NDA templates.
|
||||||
# Match: section header containing "Vertragsstrafe" up to the next ## section or end
|
|
||||||
pattern = r'(^## \d+[\.:]?\s+[^\n]*[Vv]ertragsstrafe[^\n]*\n)(.*?)(?=^## \d+|\Z)'
|
Matches bold-style heading: **N. Vertragsstrafe ...**
|
||||||
|
up to the next bold-numbered section or end of string.
|
||||||
|
"""
|
||||||
|
pattern = r'(\*\*\d+\.\s+[^\n]*[Vv]ertragsstrafe[^\n]*\*\*\n)(.*?)(?=\*\*\d+\.|\Z)'
|
||||||
return wrap_block(content, 'NDA_PENALTY_BLOCK', pattern)
|
return wrap_block(content, 'NDA_PENALTY_BLOCK', pattern)
|
||||||
|
|
||||||
|
|
||||||
def apply_cookie_analytics_block(content: str) -> tuple[str, int]:
|
def apply_cookie_analytics_block(content: str) -> tuple[str, int]:
|
||||||
"""Wraps the ### Analyse section in Cookie Banner templates."""
|
"""Wraps the Analyse section in Cookie Banner templates.
|
||||||
pattern = r'(^### Analyse\b[^\n]*\n)(.*?)(?=^###|\Z)'
|
|
||||||
|
Matches: **Abschnitt „Analyse":**
|
||||||
|
up to the next **Abschnitt or end of string.
|
||||||
|
"""
|
||||||
|
pattern = r'(\*\*Abschnitt\s+[^\n]*Analyse[^\n]*\*\*[^\n]*\n)(.*?)(?=\*\*Abschnitt\s+[^\n]*Marketing|\Z)'
|
||||||
return wrap_block(content, 'COOKIE_ANALYTICS_BLOCK', pattern)
|
return wrap_block(content, 'COOKIE_ANALYTICS_BLOCK', pattern)
|
||||||
|
|
||||||
|
|
||||||
def apply_cookie_marketing_block(content: str) -> tuple[str, int]:
|
def apply_cookie_marketing_block(content: str) -> tuple[str, int]:
|
||||||
"""Wraps the ### Marketing section in Cookie Banner templates."""
|
"""Wraps the Marketing section in Cookie Banner templates.
|
||||||
pattern = r'(^### Marketing\b[^\n]*\n)(.*?)(?=^###|\Z)'
|
|
||||||
|
Matches: **Abschnitt „Marketing":**
|
||||||
|
up to the next double-newline section divider or --- or end.
|
||||||
|
"""
|
||||||
|
pattern = r'(\*\*Abschnitt\s+[^\n]*Marketing[^\n]*\*\*[^\n]*\n)(.*?)(?=\n---|\n\*\*[A-Z]\)|\Z)'
|
||||||
return wrap_block(content, 'COOKIE_MARKETING_BLOCK', pattern)
|
return wrap_block(content, 'COOKIE_MARKETING_BLOCK', pattern)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user