49 lines
2.0 KiB
Python
49 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
import os
|
|
|
|
EXCLURE = ['html', 'Scripts', '__pycache__', '.git']
|
|
OUTPUT_FILE = "index.html"
|
|
|
|
def generer_index_general():
|
|
road_trips = []
|
|
for d in sorted(os.listdir('.')):
|
|
if os.path.isdir(d) and d not in EXCLURE:
|
|
# On cherche mini.html en priorité
|
|
if os.path.exists(os.path.join(d, 'mini.html')):
|
|
road_trips.append(d)
|
|
|
|
html_content = f"""
|
|
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Nos Road-Trips</title>
|
|
<style>
|
|
body {{ font-family: 'Segoe UI', sans-serif; background: #f4f4f9; margin: 0; padding: 20px; }}
|
|
.grid {{ display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 30px; max-width: 1200px; margin: 0 auto; }}
|
|
.card {{ background: white; border-radius: 15px; overflow: hidden; box-shadow: 0 10px 20px rgba(0,0,0,0.1); }}
|
|
.map-container {{ width: 100%; height: 300px; border: none; pointer-events: none; }}
|
|
.card-content {{ padding: 20px; text-align: center; }}
|
|
.btn {{ display: inline-block; padding: 10px 25px; background: #3498db; color: white; text-decoration: none; border-radius: 25px; font-weight: bold; }}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1 style="text-align:center;">🌍 Nos Road-Trips</h1>
|
|
<div class="grid">
|
|
"""
|
|
for trip in road_trips:
|
|
html_content += f"""
|
|
<div class="card">
|
|
<iframe class="map-container" src="{trip}/mini.html"></iframe>
|
|
<div class="card-content">
|
|
<h2 style="text-transform: capitalize;">{trip.replace('-', ' ')}</h2>
|
|
<a href="{trip}/index.html" class="btn">Voir le voyage</a>
|
|
</div>
|
|
</div>
|
|
"""
|
|
html_content += "</div></body></html>"
|
|
with open(OUTPUT_FILE, "w", encoding="utf-8") as f: f.write(html_content)
|
|
|
|
if __name__ == "__main__":
|
|
generer_index_general()
|