import re

html_files = [
    'd:\\iss\\Franciscan Society\\index.html',
    'd:\\iss\\Franciscan Society\\about.html',
    'd:\\iss\\Franciscan Society\\gallery.html'
]

whatsapp_svg = '''<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="none"><path d="M12.031 21.46c-1.6 0-3.15-.43-4.5-1.25L3 21l.8-4.3c-.9-1.4-1.37-3.05-1.37-4.73C2.43 6.47 6.74 2.16 12.21 2.16c2.66 0 5.16 1.04 7.03 2.92a9.92 9.92 0 0 1 2.93 7.04c0 5.48-4.31 9.34-10.14 9.34zm-4.76-2.58l.28.17c1.3.77 2.82 1.18 4.38 1.18 4.88 0 8.85-3.23 8.85-8.1 0-2.17-.85-4.2-2.38-5.74a7.86 7.86 0 0 0-5.63-2.33c-4.94 0-8.96 4-8.96 8.94 0 1.63.43 3.2 1.25 4.54l.2.32-.47 2.53 2.58-.5z"/><path d="M17.43 14.36c-.3-.15-1.78-.88-2.05-.98-.28-.1-.47-.15-.68.15-.2.3-.77.98-.95 1.18-.17.2-.35.23-.65.08-.3-.15-1.27-.47-2.42-1.5-.9-.8-1.5-1.79-1.68-2.1-.18-.3-.02-.45.13-.6.13-.13.3-.35.45-.53.15-.17.2-.3.3-.5.1-.2.05-.38-.03-.53-.08-.15-.68-1.63-.93-2.23-.24-.59-.48-.5-.68-.52h-.58c-.2 0-.53.08-.8.38-.28.3-1.05 1.03-1.05 2.5 0 1.5 1.08 2.93 1.23 3.13.15.2 2.13 3.25 5.15 4.55 2.05.88 2.58.93 3.4.78.85-.15 1.78-.73 2.03-1.43.25-.7.25-1.3.18-1.43-.08-.13-.28-.2-.58-.35z"/></svg>'''

for file_path in html_files:
    with open(file_path, 'r', encoding='utf-8') as f:
        content = f.read()
    
    # Replace the WhatsApp SVG
    # Find the whatsapp-icon a tag and replace its contents
    pattern = r'(<a href="https://wa.me/"[^>]*class="chat-icon whatsapp-icon">)\s*<svg.*?</svg>\s*(</a>)'
    content = re.sub(pattern, r'\1\n                ' + whatsapp_svg + r'\n            \2', content, flags=re.DOTALL)
    
    with open(file_path, 'w', encoding='utf-8') as f:
        f.write(content)
        
print("Fixed WhatsApp icons")
