Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
21 lignes
1.5 KiB
Python
21 lignes
1.5 KiB
Python
p='modele.html'; s=open(p,encoding='utf-8').read()
|
|
# 1. propriétaires et lieux de consultation
|
|
s=s.replace("const MASSIF =", """// Propriétaire des stations « de chez nous » ; 'dispo' = où l'on retrouve aussi la station (jamais Infoclimat en premier)
|
|
const PROPRIO = {lans:'Station Gastinel', moucherolle:'Station Gastinel',
|
|
geve:'Station Richard Gastinel', allieres:'Station Richard Gastinel', bruyeres:'Station Richard Gastinel',
|
|
darbounouse:'Station Richard Gastinel', oscence:'Station Richard Gastinel'};
|
|
const DISPO = ['WeatherLink', 'ROMMA', 'Infoclimat'];
|
|
function origine(id){
|
|
const s = STATIONS[id], p = PROPRIO[id];
|
|
if (p) return {titre: p, aussi: 'Aussi consultable sur ' + DISPO.join(' · ')};
|
|
const src = s.src || '';
|
|
return {titre: src ? 'Vient ' + (/^[AEIOUÉ]/i.test(src) ? "d'" : 'de ') + src : '', aussi: ''};
|
|
}
|
|
const MASSIF =""",1)
|
|
# 2. encadré bleu à côté du titre
|
|
s=s.replace("`<h2>${s.nom}${icones(id)}</h2>","`<h2>${s.nom}${icones(id)}${(o => o.titre ? `<span class=\"origine\">${o.titre}${o.aussi ? `<small>${o.aussi}</small>` : ''}</span>` : '')(origine(id))}</h2>",1)
|
|
s=s.replace(".plein-sous{", """.origine{display:inline-flex;flex-direction:column;vertical-align:middle;margin-left:12px;padding:3px 9px;border:1px solid var(--glacier);background:rgba(110,181,189,.14);color:#2f6f78;font-family:var(--texte,inherit);font-size:12px;font-weight:500;line-height:1.25}
|
|
.origine small{font-size:11px;font-weight:400;color:var(--gris)}
|
|
.plein-sous{""",1)
|
|
open(p,'w',encoding='utf-8').write(s)
|