diff --git a/scripts/artifacts.py b/scripts/artifacts.py index 873d8580..90d1dbba 100644 --- a/scripts/artifacts.py +++ b/scripts/artifacts.py @@ -21,6 +21,7 @@ _TIMESTAMP_PATTERNS = [ # The decorated pages carry the same stamp again as a rendered element, # and missing it rewrote every page on every run for the clock alone. re.compile(r'
'), + re.compile(r''), ] def write_if_changed( diff --git a/scripts/generate_site.py b/scripts/generate_site.py index c2b625bc..044a1685 100644 --- a/scripts/generate_site.py +++ b/scripts/generate_site.py @@ -416,6 +416,11 @@ def data_as_of(moment: datetime | None = None) -> str: f"Data as of {moment.day} {moment.strftime('%B %Y')}") +def _date_line() -> str: + """The date a page closes on, in the words of data_as_of().""" + return f'' + + # Home page @@ -2581,7 +2586,7 @@ def _render_platform_systems( for i, other in enumerate(stems, 1))] if len(runs) > 1 else []), "", "## Files", "", *search_excluded(run), - "", f"*Generated on {_timestamp()}*", + "", _date_line(), ]) + "\n" where = (f"[a page of their own]({stems[0]}.md)" if len(stems) == 1 else "pages of their own: " + ", ".join( @@ -3088,7 +3093,7 @@ def generate_platform_page( (name, display), moved, config) ) - lines.append(f"*Generated on {_timestamp()}*") + lines.extend(["", _date_line()]) return "\n".join(lines) + "\n" @@ -3702,7 +3707,7 @@ def generate_provenance_page( lines.append(f"| `{name}` | {sources} | {how.get('transform', '')} | `{sha1}` |") lines.append("") - lines.append(f'') + lines.extend(["", _date_line()]) return "\n".join(lines) + "\n" @@ -4357,7 +4362,7 @@ def system_pages( lines.extend(_cards_markdown(cards)) lines.append("") lines.extend(_next_block(_NEXT_FROM_SYSTEMS)) - lines.append(f'') + lines.extend(["", _date_line()]) return "\n".join(lines) + "\n" def card_weight(card: list[str]) -> int: @@ -4454,12 +4459,12 @@ def system_pages( lines.append("") lines.extend(_next_block([f"[{manufacturer}]({slug}.md), every section"] + _NEXT_FROM_SYSTEMS)) - lines.append(f'') + lines.extend(["", _date_line()]) held = {sha1 for _variant, _card, sha1 in part} pages[stem] = ("\n".join(lines) + "\n", {console: [ f for f in consoles[console] if str(f.get("sha1", "")) in held]}) summary.extend(_next_block(_NEXT_FROM_SYSTEMS)) - summary.append(f'') + summary.extend(["", _date_line()]) kept = {console: files for console, files in consoles.items() if console not in moved} return {slug: ("\n".join(summary) + "\n", kept), **pages} @@ -5853,7 +5858,7 @@ def emulator_pages( "[Every system](../systems/index.md), and the files each one needs", "[When a game does not start](../wiki/troubleshooting.md)", ])) - lines.extend([f"*Generated on {_timestamp()}*"]) + lines.extend(["", _date_line()]) return {name: "\n".join(lines) + "\n", **part_pages} @@ -5910,7 +5915,7 @@ def _emulator_part_page( lambda group: [line for i in group for line in cards[i]]), ] lines.extend(_next_block([f"[{emu_name}]({name}.md), the profile and every entry"])) - lines.extend([f"*Generated on {_timestamp()}*"]) + lines.extend(["", _date_line()]) return "\n".join(lines) + "\n" @@ -6650,7 +6655,7 @@ def generate_gap_analysis( ) lines.append("") - lines.extend(["", f'']) + lines.extend(["", _date_line()]) return "\n".join(lines) + "\n" @@ -6921,7 +6926,7 @@ def generate_cross_reference( lines.extend(_render_xref_by_platform(coverages, unique, moved)) lines.extend(_render_xref_by_upstream(coverages, unique)) - lines.extend(["", f"*Generated on {_timestamp()}*"]) + lines.extend(["", _date_line()]) return "\n".join(lines) + "\n" @@ -7071,7 +7076,7 @@ def generate_wiki_data_model(db: dict, profiles: dict) -> str: "## Static API and bulk exports", "", "The website publishes versioned JSON, CSV and SQLite metadata generated " - "from these same structures. Start with the [Data & API](../data.md) " + "from these same structures. Start with the [Data and API](../data.md) " "catalog. Each downloadable artifact carries a SHA256 in " "`api/v1/catalog.json`.", "", diff --git a/scripts/sitediagrams.py b/scripts/sitediagrams.py index b108ed96..186a1f3c 100644 --- a/scripts/sitediagrams.py +++ b/scripts/sitediagrams.py @@ -330,7 +330,9 @@ def setups() -> tuple[str, ...]: def setups_named(named: list[str]) -> str: """*named*, then how many other setups there are: "A, B and 15 more".""" - others = len(setups()) - len(named) + from siteguides import setup_count + + others = setup_count() - len(named) return ", ".join(named) + (f" and {others} more" if others else "")