Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
53 lignes
5.6 KiB
Python
53 lignes
5.6 KiB
Python
p='modele.html'; s=open(p,encoding='utf-8').read()
|
|
def sub(a,b):
|
|
global s
|
|
assert s.count(a)==1, a[:60]; s=s.replace(a,b)
|
|
# 1. le G de Gastinel (Inter gras, comme le logo « Gastinel. » du Hub), en noir
|
|
sub("html{scroll-behavior:smooth}","@font-face{font-family:'GastinelG';font-weight:700;font-display:swap;src:url(polices/inter-g.woff2) format('woff2')}\nhtml{scroll-behavior:smooth}")
|
|
# 2. retirer le bouton de l'encadré du titre
|
|
i=s.index('<div class="compte-bloc">'); j=s.index('</div>',i)+6; s=s[:i]+s[j:].lstrip('\n ')
|
|
a=s.index(".compte-bloc{margin-top:10px}"); b=s.index(".compte-bloc small{display:block;margin-top:5px;font-size:11px;color:var(--gris)}")+len(".compte-bloc small{display:block;margin-top:5px;font-size:11px;color:var(--gris)}")
|
|
s=s[:a]+""".compte{display:inline-flex;align-items:center;gap:8px;padding:5px 11px 5px 7px;background:#fff;border:1px solid #000;color:#000;font-size:12px;font-weight:600;text-decoration:none}
|
|
.compte:hover{background:#ecebe5}
|
|
.compte .gmark{font-family:'GastinelG','Inter',system-ui,sans-serif;font-weight:700;font-size:22px;line-height:1;color:#000;letter-spacing:-.02em}
|
|
.forum-box{position:absolute;right:226px;bottom:16px;z-index:3;width:262px;padding:9px 12px 10px;background:rgba(250,249,245,.94);border:1px solid var(--roche);box-shadow:0 0 0 3px rgba(250,249,245,.94),0 0 0 4px var(--pierre);font-size:12px;color:var(--roche)}
|
|
.forum-box .fb-titre{display:flex;justify-content:space-between;align-items:baseline;font-family:var(--titre);font-weight:700;font-size:17px;color:var(--sapin);text-decoration:none}
|
|
.forum-box .fb-titre small{font-family:var(--texte);font-size:11px;font-weight:600;letter-spacing:.1em;text-transform:uppercase}
|
|
.forum-box .fb-titre:hover{text-decoration:underline}
|
|
.forum-box p{margin:3px 0 7px;line-height:1.35}
|
|
.forum-box .fb-une{font-family:var(--titre);font-size:13px}
|
|
.forum-box .fb-atouts{font-size:11px;color:var(--gris);margin-bottom:8px}
|
|
.forum-box.mobile{display:none}
|
|
@media (max-width:1240px){.forum-box{right:28px;bottom:68px;width:244px}}
|
|
@media (max-width:719px){.carte .forum-box{display:none}.forum-box.mobile{display:block;position:static;width:auto;flex:0 0 100%;margin:4px 0 0}}"""+s[b:]
|
|
sub(".cartouche.replie #retour,.cartouche.replie .outils,.cartouche.replie .compte-bloc{display:none}",".cartouche.replie #retour,.cartouche.replie .outils{display:none}")
|
|
# 3. encadré Forum sur la carte (bureau) et sous la carte (téléphone)
|
|
BOX = '''<div class="forum-box%s"><a class="fb-titre" href="forum/index.html">Forum <small>Entrer →</small></a>
|
|
<p class="fb-une" data-une>Le récapitulatif de la semaine, par les adhérents, arrive ici.</p>
|
|
<p class="fb-atouts">Un compte Gastinel : forum avec rôle, favoris, alerte gel.</p>
|
|
<a class="compte" href="forum/connexion.html"><span class="gmark" aria-hidden="true">G</span>Se connecter avec Gastinel</a></div>'''
|
|
sub(' <a class="suite" href="#stations">Toutes les stations ↓</a>',' <a class="suite" href="#stations">Toutes les stations ↓</a>\n '+(BOX % ''))
|
|
sub('<div class="temps" id="temps">','<div class="temps" id="temps">',) if False else None
|
|
sub(' <p class="aide">Ces choix valent aussi pour la liste des stations, plus bas.</p>',' <p class="aide">Ces choix valent aussi pour la liste des stations, plus bas.</p>\n '+(BOX % ' mobile'))
|
|
# 4. « À la une » du forum : data/forum-une.json si présent ({titre, auteur, url})
|
|
sub("function apresDonnees(){","""fetch('data/forum-une.json?' + Math.floor(Date.now() / 300000)).then(r => r.ok ? r.json() : null).then(u => {
|
|
if (!u || !u.titre) return;
|
|
document.querySelectorAll('[data-une]').forEach(p => { p.innerHTML = ''; const a = document.createElement('a'); a.href = u.url || 'forum/index.html'; a.textContent = u.titre; a.style.color = 'inherit'; p.append(a); if (u.auteur) p.append(' · ' + u.auteur); });
|
|
}).catch(() => {});
|
|
function apresDonnees(){""")
|
|
open(p,'w',encoding='utf-8').write(s)
|
|
|
|
# forum : G, pied de page collé en bas
|
|
g=open('gen_forum.py',encoding='utf-8').read()
|
|
def sg(a,b):
|
|
global g
|
|
assert g.count(a)==1, a[:60]; g=g.replace(a,b)
|
|
sg("FONTS = \"\"\"@font-face{font-family:'Bitter';font-style:normal;","FONTS = \"\"\"@font-face{font-family:'GastinelG';font-weight:700;font-display:swap;src:url(../polices/inter-g.woff2) format('woff2')}\n@font-face{font-family:'Bitter';font-style:normal;")
|
|
sg("html,body{margin:0;background:var(--calcaire);color:var(--roche);font-family:var(--texte);line-height:1.5}","html,body{margin:0;background:var(--calcaire);color:var(--roche);font-family:var(--texte);line-height:1.5}\nbody{min-height:100vh;display:flex;flex-direction:column}")
|
|
sg("main{max-width:900px;margin:0 auto;padding:18px 24px 48px}","main{flex:1 0 auto;width:100%;max-width:900px;margin:0 auto;padding:18px 24px 48px}")
|
|
sg(".btn{display:inline-flex;align-items:center;gap:10px;padding:8px 14px 8px 8px;background:#fff;border:1px solid var(--sapin);color:var(--sapin);",".btn{display:inline-flex;align-items:center;gap:10px;padding:8px 14px 8px 10px;background:#fff;border:1px solid #000;color:#000;")
|
|
sg(".btn:hover{background:var(--sapin);color:#fff}\n.btn .gmark{display:inline-grid;place-items:center;width:26px;height:26px;background:var(--sapin);color:#fff;font-family:var(--titre);font-weight:700;font-size:16px}\n.btn:hover .gmark{background:#fff;color:var(--sapin)}",
|
|
".btn:hover{background:#ecebe5}\n.btn .gmark{font-family:'GastinelG','Inter',system-ui,sans-serif;font-weight:700;font-size:26px;line-height:1;color:#000;letter-spacing:-.02em}")
|
|
sg(".pied{background:#303336;color:#d1d3d6;padding:24px 24px 20px;font-size:13px}",".pied{flex:0 0 auto;background:#303336;color:#d1d3d6;padding:24px 24px 20px;font-size:13px}")
|
|
open('gen_forum.py','w',encoding='utf-8').write(g)
|