#!/usr/bin/env python3 """ Fix script for landvex.com audit issues. Run from the directory containing all HTML files. """ import os import re import glob # Target copyright text COPYRIGHT_TARGET = "© 2026 Landvex AB · Org.nr 559141-7042 · Tyresö, Sweden" # Patterns to find and replace for copyright COPYRIGHT_PATTERNS = [ # Pattern -> replacement (r'© 2026 Landvex Inc · Landvex AB \(org\.nr 559141-7042\)', COPYRIGHT_TARGET), (r'© 2026 Landvex AB · org\.nr 559141-7042 · Tyresö, Sweden', COPYRIGHT_TARGET), (r'© 2026 LandveX AB · Org\.nr 559141-7042', COPYRIGHT_TARGET), (r'© 2026 Landvex\. All rights reserved\.', COPYRIGHT_TARGET), (r'© 2026 Landvex AB  ·  Org\.nr 559141-7042', COPYRIGHT_TARGET), (r'© 2026 Landvex Inc · Landvex AB \(org\.nr 559141-7042\)', COPYRIGHT_TARGET), ] # Nav patterns: change Enterprise to Contact in main nav # Only change the top-level nav item, not dropdown items NAV_ENTERPRISE_PATTERNS = [ # Main nav item (not in dropdown) (r'
  • Enterprise
  • ', '
  • Contact
  • '), ] # Remove /comparison/ from Products dropdown # This is tricky - we need to remove the comparison link from dropdowns COMPARISON_DROPDOWN_PATTERN = r'\s*]*>.*?\s*Compare →\s*\s*' # Remove /about/ from footer ABOUT_FOOTER_PATTERN = r'About\s*' # Remove /comparison/ from footer (but keep SLA) COMPARISON_FOOTER_PATTERN = r'Compare\s*' def fix_file(filepath): """Apply all fixes to a single file.""" with open(filepath, 'r', encoding='utf-8', errors='ignore') as f: content = f.read() original = content changes = [] # Fix 1: Copyright text for pattern, replacement in COPYRIGHT_PATTERNS: if re.search(pattern, content): content = re.sub(pattern, replacement, content) changes.append(f"copyright: {pattern[:50]}...") # Fix 2: Nav Enterprise -> Contact (only top-level nav, not dropdown) # Be careful - only change
  • Enterprise
  • outside dropdowns for pattern, replacement in NAV_ENTERPRISE_PATTERNS: if pattern in original: content = content.replace(pattern, replacement) changes.append("nav: Enterprise -> Contact") # Fix 3: Remove comparison from dropdown if re.search(COMPARISON_DROPDOWN_PATTERN, original, re.DOTALL): content = re.sub(COMPARISON_DROPDOWN_PATTERN, '', content, flags=re.DOTALL) changes.append("dropdown: removed /comparison/") # Fix 4: Remove /about/ from footer if re.search(ABOUT_FOOTER_PATTERN, original): content = re.sub(ABOUT_FOOTER_PATTERN, '', content) changes.append("footer: removed /about/") # Fix 5: Remove /comparison/ from footer if re.search(COMPARISON_FOOTER_PATTERN, original): content = re.sub(COMPARISON_FOOTER_PATTERN, '', content) changes.append("footer: removed /comparison/") if content != original: with open(filepath, 'w', encoding='utf-8') as f: f.write(content) return changes return [] def main(): base_dir = "/home/bernt/.openclaw/workspace/landvex-all" # Find all HTML files html_files = [] for root, dirs, files in os.walk(base_dir): for file in files: if file.endswith('.html'): html_files.append(os.path.join(root, file)) print(f"Found {len(html_files)} HTML files") total_changes = 0 files_changed = 0 for filepath in sorted(html_files): rel_path = os.path.relpath(filepath, base_dir) changes = fix_file(filepath) if changes: files_changed += 1 total_changes += len(changes) print(f" {rel_path}: {', '.join(changes)}") print(f"\nDone: {files_changed} files changed, {total_changes} total fixes") if __name__ == "__main__": main()