27 lines
1.9 KiB
Python
27 lines
1.9 KiB
Python
import re
|
|
|
|
with open('c:/Users/Admin/TNCSC_Odoo/addons/tncsc_deployment/views/website_pages.xml', 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
pattern = r'<div class="d-flex justify-content-center align-items-center gap-3 mb-4">\s*<a href="/" class="text-white text-decoration-none fw-medium fs-6">Home</a>\s*<span class="text-white-50">\|</span>\s*<a href="/about" class="text-white text-decoration-none fw-medium fs-6">About Us</a>\s*<span class="text-white-50">\|</span>\s*<a href="/membership" class="text-white text-decoration-none fw-medium fs-6">Membership</a>\s*<span class="text-white-50">\|</span>\s*<a href="/contact" class="text-white text-decoration-none fw-medium fs-6">Contact</a>\s*</div>'
|
|
|
|
matches = re.findall(pattern, content)
|
|
print(f'Found {len(matches)} exact matches')
|
|
|
|
replacement = '''<div class="d-flex justify-content-center align-items-center flex-wrap gap-2 gap-md-3 mb-4">
|
|
<a href="/" class="text-white text-decoration-none fw-medium fs-6 text-nowrap">Home</a>
|
|
<span class="text-white-50">|</span>
|
|
<a href="/about" class="text-white text-decoration-none fw-medium fs-6 text-nowrap">About Us</a>
|
|
<span class="text-white-50">|</span>
|
|
<a href="/membership" class="text-white text-decoration-none fw-medium fs-6 text-nowrap">Membership</a>
|
|
<span class="text-white-50">|</span>
|
|
<a href="/contact" class="text-white text-decoration-none fw-medium fs-6 text-nowrap">Contact</a>
|
|
</div>'''
|
|
|
|
new_content = re.sub(pattern, replacement, content)
|
|
|
|
with open('c:/Users/Admin/TNCSC_Odoo/addons/tncsc_deployment/views/website_pages.xml', 'w', encoding='utf-8') as f:
|
|
f.write(new_content)
|
|
|
|
print("Replacement complete.")
|