aaac24b05c
gates / gates (push) Successful in 4m12s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012qRErfCoiTkvDK9N5XHbzb
79 lines
4.5 KiB
Python
79 lines
4.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Dashboard pictures on the website (2026-10-08): a home-page section after „Mit tud a doboz ma?" and two pictures in
|
|
the technology page's dashboard card, each page in its own language. Reads the CURRENT pages; every insert asserts
|
|
its anchor once."""
|
|
import io, os, re, sys
|
|
W = "/mnt/5_hdd/felhom.eu/git/felhom.eu/website"
|
|
|
|
|
|
def rd(p): return io.open(os.path.join(W, p), encoding="utf-8-sig").read()
|
|
|
|
|
|
def wr(p, s):
|
|
with io.open(os.path.join(W, p), "w", encoding="utf-8-sig", newline="\n") as f: f.write(s)
|
|
|
|
|
|
def sub1(s, old, new):
|
|
assert s.count(old) == 1, (old[:80], s.count(old)); return s.replace(old, new)
|
|
|
|
|
|
SHOTS = { # page: (hu alt, hu caption, en alt, en caption)
|
|
"start": ("A vezérlőpult Indítópultja: az otthon telepített alkalmazások csempéi",
|
|
"<strong>Indítópult</strong> — minden alkalmazásod egy kattintásra.",
|
|
"The Dashboard's Launcher: tiles of the apps installed at home",
|
|
"<strong>Launcher</strong> — every app you have, one click away."),
|
|
"apps": ("Az Alkalmazások oldal: telepített és telepíthető alkalmazások kártyái, állapottal",
|
|
"<strong>Alkalmazások</strong> — telepítés pár kattintással, és látod, mi fut és mi naprakész.",
|
|
"The Apps page: cards of installed and installable apps, with their status",
|
|
"<strong>Apps</strong> — install in a few clicks, and see what runs and what is up to date."),
|
|
"app": ("Egy alkalmazás saját oldala: mire jó, képek, és az első lépések",
|
|
"<strong>Egy alkalmazás oldala</strong> — mire jó, hova tedd a fájlokat, és hogyan kezdj hozzá.",
|
|
"An app's own page: what it is for, pictures, and the first steps",
|
|
"<strong>An app's page</strong> — what it is for, where your files go, and how to start."),
|
|
"backups": ("A mentések oldala: minden alkalmazás adatbázisának éjszakai mentése, ellenőrizve",
|
|
"<strong>Mentések</strong> — minden éjjel minden alkalmazás adatbázisa mentésre kerül, és ellenőrizzük.",
|
|
"The backups page: each app's database backed up overnight, and checked",
|
|
"<strong>Backups</strong> — every night each app's database is backed up and checked."),
|
|
}
|
|
|
|
|
|
def fig(page, lang):
|
|
hu_alt, hu_cap, en_alt, en_cap = SHOTS[page]
|
|
alt, cap = (hu_alt, hu_cap) if lang == "hu" else (en_alt, en_cap)
|
|
src = "/assets/dashboard-%s-%s.webp" % (page, lang)
|
|
return (' <figure class="dash-shot">\n'
|
|
' <a href="%s"><img src="%s" alt="%s" width="1440" height="900" loading="lazy"></a>\n'
|
|
' <figcaption>%s</figcaption>\n'
|
|
' </figure>') % (src, src, alt, cap)
|
|
|
|
|
|
def home_section(lang):
|
|
if lang == "hu":
|
|
sid, h2, sub = "vezerlopult", "Így néz ki <span>a vezérlőpult</span>", "Valódi képek egy Felhom dobozról — kattints rájuk a teljes mérethez"
|
|
else:
|
|
sid, h2, sub = "dashboard", "What the <span>Dashboard looks like</span>", "Real pictures from a Felhom box — click one for the full size"
|
|
figs = "\n".join(fig(p, lang) for p in ("start", "apps", "app", "backups"))
|
|
return (' <section class="content-section" id="%s">\n <div class="container">\n'
|
|
' <div class="section-header">\n <h2>%s</h2>\n <p>%s</p>\n </div>\n'
|
|
' <div class="dash-grid">\n%s\n </div>\n </div>\n </section>\n\n') % (sid, h2, sub, figs)
|
|
|
|
|
|
ANCHOR_HOME = ' <section class="content-section alt-bg">\n'
|
|
for p, lang in (("index.html", "hu"), ("en/index.html", "en")):
|
|
s = rd(p)
|
|
i = s.index('id="mit-tud"' if lang == "hu" else 'id="what-it-does"')
|
|
j = s.index(ANCHOR_HOME, i)
|
|
s = s[:j] + home_section(lang) + s[j:]
|
|
wr(p, s)
|
|
print(p, "section added")
|
|
|
|
TECH_ANCHOR = {"hu": ' <div class="highlight-box">\n <p><strong>Tökéletes:</strong>',
|
|
"en": ' <div class="highlight-box">\n <p><strong>Good for:</strong>'}
|
|
for p, lang in (("technologiak.html", "hu"), ("en/technology.html", "en")):
|
|
s = rd(p)
|
|
block = (' <div class="dash-grid">\n%s\n </div>\n\n'
|
|
% "\n".join(" " + l for f in (fig("apps", lang), fig("backups", lang)) for l in f.split("\n")))
|
|
s = sub1(s, TECH_ANCHOR[lang], block + TECH_ANCHOR[lang])
|
|
wr(p, s)
|
|
print(p, "pictures added")
|