diff --git a/scripts/site_gates.py b/scripts/site_gates.py index 1508674b..b4ecc585 100644 --- a/scripts/site_gates.py +++ b/scripts/site_gates.py @@ -120,12 +120,43 @@ MOCKUPS = {os.path.join("preview", "m1", "index.html"), # every live page becomes one of these. They keep every other check; what changes for them is # WHICH block has to be identical across the set: the sidebar, not the nav and footer. Gate 3 # below does both, so there is one identity gate rather than two. -SHELL = {os.path.join("preview", "m3", "index.html")} +SHELL = { + os.path.join("preview", "m3", 'index.html'), + os.path.join("preview", "m3", 'alkalmazasok.html'), + os.path.join("preview", "m3", 'technologiak.html'), + os.path.join("preview", "m3", 'biztonsagimentes.html'), + os.path.join("preview", "m3", 'gyik.html'), + os.path.join("preview", "m3", 'teszteles.html'), + os.path.join("preview", "m3", 'kapcsolat.html'), + os.path.join("preview", "m3", 'letoltes.html'), + os.path.join("preview", "m3", 'adatkezeles.html'), + os.path.join("preview", "m3", 'feltetelek.html'), + os.path.join("preview", "m3", '404.html'), + os.path.join("preview", "m3", "en", 'index.html'), + os.path.join("preview", "m3", "en", 'apps.html'), + os.path.join("preview", "m3", "en", 'technology.html'), + os.path.join("preview", "m3", "en", 'backups.html'), + os.path.join("preview", "m3", "en", 'faq.html'), + os.path.join("preview", "m3", "en", 'testing.html'), + os.path.join("preview", "m3", "en", 'contact.html'), + os.path.join("preview", "m3", "en", 'download.html'), +} PAGES = list(TWINS) + list(TWINS.values()) + sorted(NO_TWIN) + sorted(MOCKUPS) + sorted(SHELL) EN_PAGES = set(TWINS.values()) HU_PAGES = set(PAGES) - EN_PAGES - MOCKUPS - SHELL ANALYTICS_EXEMPT = {"szolgaltatasok-nonpublic.html"} | MOCKUPS + + +def is_en(p): + """A page is English if it is a TWINS value OR it lives under an `en/` directory. The second + half matters for the shell pages staged at preview/m3/en/*, which are not in TWINS yet: without + it the dash-language, and no-Hungarian gates all judged them as Hungarian.""" + return p in EN_PAGES or p.split(os.sep)[0] == "en" or (os.sep + "en" + os.sep) in p + + +def lang_of(p): + return "en" if is_en(p) else "hu" ANALYTICS_MARK = "https://stats.felhom.eu/script.js" SITE = "https://felhom.eu" @@ -162,9 +193,19 @@ GLOBE_ITEM_RE = re.compile(r'([^<]*)') +def _drop_state_classes(m): + """Remove the markers that legitimately differ per page from a class list: `active` on the + current item, and `is-open` on the nav group containing it (the shell renders that group open, + exactly as the controller does). Everything else in the class must match.""" + keep = [c for c in m.group(1).split() if c not in ("active", "is-open")] + return 'class="%s"' % " ".join(keep) if keep else "" + + def norm_block(b): b = b.replace(' class="active"', "") b = re.sub(r'\s*aria-current="[^"]*"', "", b) + b = re.sub(r'\s*aria-expanded="[^"]*"', "", b) # open/closed state of the same group + b = re.sub(r'class="([^"]*)"', _drop_state_classes, b) # the globe is the one nav item whose content differs per page (its targets, its current mark, its label) — # gate 13 checks all of that; here only its presence must match b = GLOBE_RE.sub('
', b) @@ -246,7 +287,7 @@ for p in sorted(SHELL): if not m: fail("%s: no