- New pages built from the records: lists by length, time to walk, month, kind of walking and holder; place-by-list pages; a Triple Crown table and key-figure tables for the National Scenic and Recreation Trails; highest points, most climbing and climb per mile; a page for every route author, with the authors of three or more routes leading the authors page; connected trails; recently added and changed; a glossary and a method page. Every place page opens with a summary. - Trail pages open with an "In brief" paragraph generated from the record and show when the record was last checked. The About page says who maintains the site and how to reach them. - The map starts when it is reached, not with the page. The site's own CSS, scripts and fonts are fingerprinted and cached for a year. Every image has its dimensions. - Titles are held to 60 characters and share previews get their own shorter description. - Social cards are redrawn so a long name can no longer push text into the footer, and the site-wide card takes its wording from the site settings instead of an old hand-made image. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
"""The small editorial data files at the top of the repository, read for the pages built from them.
|
|
|
|
glossary.toml [[term]] the Glossary page (olt/reference.py)
|
|
collections.toml [[collection]] named sets of trails set side by side (olt/standing.py)
|
|
authors.toml [[author]] route authors credited in more than one form (olt/authors.py)
|
|
|
|
Each is checked by tools/validate.py and described in docs/schema.md. Like left-out.toml, a file
|
|
is looked for in the repository being built and then in this one, so a test repository without
|
|
one still builds.
|
|
"""
|
|
import os
|
|
import tomllib
|
|
|
|
REAL_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
|
|
def load(repo_root, name, table):
|
|
"""The array of tables `table` in file `name`, or []."""
|
|
for base in (repo_root, REAL_ROOT):
|
|
path = os.path.join(base or REAL_ROOT, name)
|
|
if os.path.isfile(path):
|
|
with open(path, "rb") as f:
|
|
return tomllib.load(f).get(table) or []
|
|
return []
|
|
|
|
|
|
def glossary(repo_root):
|
|
return load(repo_root, "glossary.toml", "term")
|
|
|
|
|
|
def collections(repo_root):
|
|
return load(repo_root, "collections.toml", "collection")
|
|
|
|
|
|
def authors(repo_root):
|
|
return load(repo_root, "authors.toml", "author")
|