Files
sisvietnamvn_01/sisvietnamvn_main/replace_footer_logo.py
T

17 lines
673 B
Python

import re
filepath = "src/main/resources/templates/themes/umass/footer.html"
with open(filepath, "r", encoding="utf-8") as f:
content = f.read()
# We want to replace the `a.logo` block with our new logo
# Using DOTALL to match across newlines
pattern = r'<a class="logo"[^>]*>.*?</a>'
replacement = '<a class="logo" href="/" aria-label="Sisvietnamvn">\n <div>\n <img th:src="@{/theme-assets/umass/images/logo.png}" alt="Sisvietnamvn" style="height: 60px; width: auto;"/>\n </div>\n</a>'
content = re.sub(pattern, replacement, content, count=1, flags=re.DOTALL)
with open(filepath, "w", encoding="utf-8") as f:
f.write(content)
print("Updated footer.html")