Files
longhikes/web/olt/datafiles.py
T
swaitsandClaude Fable 5.2 f467fcb560
Mirror to forge / mirror (push) Canceled after 0s
Validate / validate (push) Canceled after 0s
Validate / history (push) Canceled after 0s
Validate / site (push) Canceled after 0s
Validate / deploy (push) Canceled after 0s
Say who each route author is, with a biography from the database
authors.toml gains a summary, a biography, the author's own site and
the pages each was read on, for people only. An author's page now
opens with the name and the summary, shows a joint credit only on the
route it applies to, and carries an About section after the routes.
People with three or more routes lead the authors page. Organisations
get no biography.

35 people have a summary and a biography and 4 a summary only, each
statement checked against the page it cites. Wilderness Mindset is
recorded as two people. The Sawtooth Wilderness High Route is credited
to Eric Poulin, who names himself as the author of Seeking Lost.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-17 12:09:34 -07:00

43 lines
1.6 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)
[[list]] which lists the home page shows, and in what order (olt/home.py)
authors.toml [[author]] route authors, and the words about the people among them (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")
def lists(repo_root):
"""The [[list]] entries of collections.toml: a list's key, and `home`, its place in the home page's row."""
return load(repo_root, "collections.toml", "list")