diff --git a/scripts/apply_block_markers_022.py b/scripts/apply_block_markers_022.py index b3f3091..c3baa50 100644 --- a/scripts/apply_block_markers_022.py +++ b/scripts/apply_block_markers_022.py @@ -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]: - """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)' + """Wraps the Vertragsstrafe section in NDA templates. + + 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) def apply_cookie_analytics_block(content: str) -> tuple[str, int]: - """Wraps the ### Analyse section in Cookie Banner templates.""" - pattern = r'(^### Analyse\b[^\n]*\n)(.*?)(?=^###|\Z)' + """Wraps the Analyse section in Cookie Banner templates. + + 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) def apply_cookie_marketing_block(content: str) -> tuple[str, int]: - """Wraps the ### Marketing section in Cookie Banner templates.""" - pattern = r'(^### Marketing\b[^\n]*\n)(.*?)(?=^###|\Z)' + """Wraps the Marketing section in Cookie Banner templates. + + 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)