-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd-footer-pages.py
More file actions
84 lines (68 loc) · 3.24 KB
/
add-footer-pages.py
File metadata and controls
84 lines (68 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Script para agregar footer a las páginas que les falta
"""
import re
import sys
# Configure UTF-8 encoding for Windows
if sys.version_info >= (3, 7):
sys.stdout.reconfigure(encoding='utf-8')
FOOTER_HTML = '''
<footer style="background: rgba(26, 0, 51, 0.9); padding: 2rem 1rem; margin-top: 4rem; border-top: 2px solid var(--neon-cyan); text-align: center; position: relative; z-index: 10;">
<div style="max-width: 1200px; margin: 0 auto;">
<div style="display: flex; flex-wrap: wrap; justify-content: center; gap: 2rem; margin-bottom: 1.5rem;">
<a href="index.html" style="color: var(--neon-cyan); text-decoration: none; font-weight: bold; transition: all 0.3s ease;">Inicio</a>
<a href="articles.html" style="color: var(--neon-cyan); text-decoration: none; font-weight: bold; transition: all 0.3s ease;">Artículos</a>
<a href="about.html" style="color: var(--neon-cyan); text-decoration: none; font-weight: bold; transition: all 0.3s ease;">Acerca de</a>
<a href="contact.html" style="color: var(--neon-cyan); text-decoration: none; font-weight: bold; transition: all 0.3s ease;">Contacto</a>
<a href="privacy-policy.html" style="color: var(--neon-cyan); text-decoration: none; font-weight: bold; transition: all 0.3s ease;">Política de Privacidad</a>
</div>
<p style="color: var(--text-secondary); font-size: 0.9rem; margin: 0;">
© 2025 ChessArcade. Todos los derechos reservados.
</p>
<p style="color: var(--neon-magenta); font-size: 0.85rem; margin-top: 0.5rem;">
Hecho con 💜 para la comunidad de ajedrez
</p>
</div>
</footer>
'''
def add_footer_if_missing(filepath):
"""Agrega footer si no existe"""
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
# Check if already has footer
if '<footer' in content:
print(f"✓ {filepath} ya tiene footer")
return
# Find closing div of neon-container and </body>
# Add footer before closing </div> of neon-container
# Find the last </div> before </body>
body_close = content.rfind('</body>')
if body_close == -1:
print(f"✗ No se encontró </body> en {filepath}")
return
# Find last </div> before </body>
last_div = content.rfind('</div>', 0, body_close)
if last_div == -1:
print(f"✗ No se encontró </div> antes de </body> en {filepath}")
return
# Insert footer before the last </div>
content = content[:last_div] + FOOTER_HTML + '\n' + content[last_div:]
# Write back
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
print(f"✓ Footer agregado a {filepath}")
# Files to update
files = [
'C:\\Users\\clau\\Documents\\Multiajedrez 2025\\contact.html',
'C:\\Users\\clau\\Documents\\Multiajedrez 2025\\about.html',
'C:\\Users\\clau\\Documents\\Multiajedrez 2025\\privacy-policy.html'
]
print("Agregando footer a páginas...\n")
for filepath in files:
try:
add_footer_if_missing(filepath)
except Exception as e:
print(f"✗ Error en {filepath}: {e}")
print("\n✓ Proceso completado!")