#!/usr/bin/env python3 """Verify no double hyphens in visible text content.""" import re with open('/root/projects/itpp-infrastructure/projects/hotnow-savannah-v2.html') as f: html = f.read() # Remove all HTML tags, comments, and style blocks clean = html # Remove style blocks clean = re.sub(r'', '', clean, flags=re.DOTALL) # Remove HTML comments clean = re.sub(r'', '', clean, flags=re.DOTALL) # Remove HTML tags clean = re.sub(r'<[^>]+>', '', clean) # Decode HTML entities that contain -- clean = clean.replace('—', '') # Find -- matches = list(re.finditer(r'--', clean)) if matches: print(f'Found {len(matches)} double hyphens in visible text:') for m in matches[:20]: ctx = clean[max(0,m.start()-30):m.end()+30] print(f' offset {m.start()}: "...{ctx.strip()}..."') else: print('ZERO double hyphens in visible text content. Clean!')