diff --git a/build.py b/build.py index cdeda0a..975a595 100644 --- a/build.py +++ b/build.py @@ -30,10 +30,9 @@ # the GitHub profile of the organisation and the repository. BANNER_SIZE = (1408, 469) PLATE_SIZE = (704, 235) -# The three sites, in the order of the top bar and the footer. The footer reads as one line. +# The three sites, in the order of the top bar and the footer. BAR = ("machine-made", "openfluids", "BoringQuantSystems") -FOOTER = " · ".join(BAR) -# The top bar ends with the type site, on every house. +# The top bar and the footer end with the type site, on every house. TYPE_BAR = ("type", "https://machine-made.github.io/type/") # One type scale for the three houses: the base size and the size of the house line, in px. SIZE, LINE_SIZE = 16, 24 @@ -264,6 +263,9 @@ def page_html(site: dict[str, Any]) -> str: f'{esc(t["name"])}' if t.get("self") else f'{esc(t["name"])}' for t in site["nav"] ) + # The footer reads as one line: the same four names as the top bar, each a link. The style draws the dot + # after each link but the last, so a dot never wraps away from its name. + footer = " ".join(f'{esc(t["name"])}' for t in site["nav"]) home = next(t["url"] for t in site["nav"] if t.get("self")) social = "\n".join( f'' @@ -309,7 +311,7 @@ def page_html(site: dict[str, Any]) -> str: {sections} diff --git a/check_site.py b/check_site.py index e328dc0..c323a1d 100644 --- a/check_site.py +++ b/check_site.py @@ -87,7 +87,7 @@ "fonts/mm-sans-OFL.txt": ("github.com/machine-made/type", "github.com/tokotype/PlusJakartaSans"), "fonts/mm-warp-OFL.txt": ("github.com/machine-made/type",), } -# The top bar: the three sites, then the type site. The footer reads the three sites. +# The top bar and the footer: the three sites, then the type site. BAR_NAMES = ("machine-made", "openfluids", "BoringQuantSystems", "type") TYPE_URL = "https://machine-made.github.io/type/" # The tags that set bold or italic by themselves. The page uses none: it has no bold and no italic face in use. @@ -95,8 +95,6 @@ BANNER_SIZE = (1408, 469) PLATE_SIZE = (704, 235) MAX_IMAGE_BYTES = 400_000 -# The one place that holds a non-ASCII character: the footer reads this line. -BAR_TEXT = "machine-made · openfluids · BoringQuantSystems" BASE_FILES = {"index.html", "style.css", "mark.svg", "llms.txt", "img/banner.jpg"} # The one gradient the page uses: it fades the top and bottom edges of the banner into the ground. MASK = "mask-image: linear-gradient(transparent, #000 10%, #000 90%, transparent);" @@ -683,10 +681,13 @@ def check_scale_and_touch(css: str, found: dict[str, str]) -> None: link = [d for c, s, d in rules if s == ".ds a" and not c] if not link or "underline" not in link[0].get("text-decoration", ""): fail("touch", "the link after a description must be underlined always, not only on hover") - for selector in (".ds a", ".bar a, .bar span"): + for selector in (".ds a", ".bar a, .bar span, footer a"): narrow = [d for c, s, d in rules if s == selector and any("(max-width:720px)" in cond for cond in c)] if not narrow or narrow[0].get("min-height") != "44px": fail("touch", f"{selector} must be at least 44px high below 720px") + dots = [d for c, s, d in rules if s == "footer a:not(:last-child)::after" and not c] + if not dots or dots[0].get("content") != '""' or "var(--muted)" not in dots[0].get("background", ""): + fail("touch", "the footer draws the dot after each link but the last in the style, so a dot never wraps alone") hover = [d for c, s, d in rules if s == ".pic:hover img" and any("(hover:hover)" in cond for cond in c)] if not any("outline-color" in d for d in hover): fail("hover", "a plate image must show its hover state without motion: .pic:hover img sets outline-color") @@ -739,8 +740,9 @@ def check_content(page: Page, html_text: str) -> str: ) if expected_duo not in html_text: fail("content", "the org line and the paragraph on the name must sit side by side, word for word as allow.json has them") - if f"" not in html_text: - fail("content", f'the footer must read "{BAR_TEXT}"') + expected_footer = " ".join(f'{html.escape(n)}' for n, u in SITES) + if f'' not in html_text: + fail("content", f"the footer must link {' · '.join(n for n, _ in SITES)}, in that order, and nothing else") order = [html_text.find(m) for m in ('class="bar"', 'class="banner"', 'class="duo"', 'class="grid"', " str: plain_repos = [f"https://github.com/{full}" for full in repos_of()] if sorted(repo_links) != sorted(plain_repos): fail("projects", "the project links are not exactly the public repositories") - # Another site is linked once, in the top bar; the current site is not linked. A project site is linked once more, - # after the description of its plate. - want = Counter(u for n, u in SITES if n != SELF) + Counter(SITE_LINKS.values()) + # Another site is linked once in the top bar and once in the footer; the current site is linked once, in the + # footer. A project site is linked once more, after the description of its plate. + want = Counter(u for n, u in SITES if n != SELF) + Counter(u for _, u in SITES) + Counter(SITE_LINKS.values()) for url in {u for _, u in SITES} | set(SITE_LINKS.values()): if hrefs.count(url) != want[url]: - fail("links", f"{url} must be linked {want[url]} time(s): in the top bar when it is another site, after the description of its plate when it is a project site") + fail("links", f"{url} must be linked {want[url]} time(s): in the top bar when it is another site, once in the footer, after the description of its plate when it is a project site") if any(kind == "h3" for kind, _ in page.headings): fail("projects", "the page has headings below h2; each project list is a plain list") if [h for kind, h in page.headings if kind == "h2"] != section_titles(): @@ -810,10 +812,8 @@ def decoded(source: str) -> str: def check_leaks(visible: str, deny: list[str]) -> None: forwards = {f"{folder}/index.html": url.split("//", 1)[1] for folder, url in REDIRECTS.items()} for name, raw in emitted(visible): - # Files are plain ASCII. The one character beyond ASCII that a reader sees is the dot of the footer - # line, which the file spells as ·. - shown = raw.replace(BAR_TEXT, "") if name == "index.html" else raw - if not shown.isascii(): + # Files are plain ASCII. + if not raw.isascii(): fail("voice", f"docs/{name} has characters that are not plain ASCII") if name != "index.html" and not raw.isascii(): continue @@ -832,7 +832,7 @@ def check_leaks(visible: str, deny: list[str]) -> None: fail("private", f"a private name appears in docs/{name} ({len(word)} letters)") raw_page = (DOCS / "index.html").read_text(encoding="utf-8", errors="replace") if (DOCS / "index.html").is_file() else "" if not raw_page.isascii(): - fail("voice", "docs/index.html has characters that are not plain ASCII; spell the dot as ·") + fail("voice", "docs/index.html has characters that are not plain ASCII") for path in DOCS.rglob("*"): for word in deny: if path.is_file() and re.search(re.escape(word), path.name, re.I): @@ -1447,7 +1447,7 @@ def run(d: Path) -> None: ("the body line height changed", "scale", [], lambda d: edit(d, "style.css", f"/ {LEADING} ", "/ 1.4 ")), ("the description link is underlined on hover only", "touch", [], lambda d: edit(d, "style.css", "text-decoration: underline 1px var(--accent);\n text-underline-offset: 0.2em;\n}\n\n@media (max-width", "text-decoration: none;\n text-underline-offset: 0.2em;\n}\n\n@media (max-width")), ("the description link is short on a narrow screen", "touch", [], lambda d: edit(d, "style.css", "width: fit-content;\n min-height: 44px;", "width: fit-content;\n min-height: 20px;")), - ("a top bar link is short on a narrow screen", "touch", [], lambda d: edit(d, "style.css", ".bar span {\n min-height: 44px;", ".bar span {\n min-height: 20px;")), + ("a top bar link is short on a narrow screen", "touch", [], lambda d: edit(d, "style.css", ".bar a,\n .bar span,\n footer a {\n min-height: 44px;", ".bar a,\n .bar span,\n footer a {\n min-height: 20px;")), ("a plate image has no hover state without motion", "hover", [], lambda d: edit(d, "style.css", "outline-color: var(--accent);", "margin: 0;")), ("font file is not a woff2", "fonts", [], lambda d: (d / "fonts" / "mm-weft.woff2").write_bytes(b"")), ("font file missing", "files", [], lambda d: (d / "fonts" / "mm-weft.woff2").unlink()), @@ -1486,14 +1486,19 @@ def run(d: Path) -> None: ("old hero comes back", "files", [], lambda d: (d / "heroes").mkdir() or (d / "heroes" / "x.svg").write_text("")), ("non-ASCII in llms.txt", "voice", [], lambda d: edit(d, "llms.txt", "## Sites", "café\n\n## Sites")), ("non-ASCII in the page", "voice", [], lambda d: edit(d, "index.html", "", "café")), - ("the footer dot written raw", "voice", [], lambda d: edit(d, "index.html", "·", "·")), + ("a dot written in the footer", "voice", [], lambda d: edit(d, "index.html", "

\n", "·

\n")), + ("a dot written in the footer as text", "content", [], lambda d: edit(d, "index.html", " · {other_name}\n', "")), ("the top bar marks another site", "content", [], lambda d: edit_all(d, "index.html", (f'{SELF}', f'{SELF}'), (f'{other_name}', f'{other_name}'))), ("the current site links to itself", "content", [], lambda d: edit(d, "index.html", f'{SELF}', f'{SELF}')), ("the current site is not marked", "content", [], lambda d: edit(d, "index.html", f'{SELF}', f"{SELF}")), ("two entries are marked", "a11y", [], lambda d: edit(d, "index.html", f'{other_name}', f'{other_name}')), ("a site linked twice", "links", [], lambda d: edit(d, "index.html", "", f'x')), - ("the current site is linked in the footer", "links", [], lambda d: edit(d, "index.html", "", f'x')), + ("the footer loses the type link", "content", [], lambda d: edit(d, "index.html", f' type

', "

")), + ("the footer is plain text again", "content", [], lambda d: edit(d, "index.html", footer_html(d), '
\n

' + " ".join(n for n, _ in SITES) + "

\n
")), + ("the footer lists type first", "content", [], lambda d: edit_all(d, "index.html", (f' type

', "

"), ("
\n

", f'

\n

type '))), + ("the footer type link goes elsewhere", "content", [], lambda d: edit(d, "index.html", f' type

', ' type

')), + ("a footer link without its site", "links", [], lambda d: edit(d, "index.html", "
", f'x
')), ("the type link is missing", "content", [], lambda d: edit(d, "index.html", f'type\n', "")), ("the type link goes elsewhere", "content", [], lambda d: edit(d, "index.html", f'type', 'type')), ("the type link moves first", "content", [], lambda d: edit_all(d, "index.html", (f'type\n', ""), ('