Sort every list of trails, and map trails that have no track
Mirror to forge / mirror (push) Canceled after 0s
Validate / validate (push) Canceled after 0s
Validate / site (push) Canceled after 0s
Validate / deploy (push) Canceled after 0s

Sorting. Every list of trails has a "Sort by" menu: name, length, time
or climb, each in both directions. Where the list is a table, the
Trail, Length, Time and Climb heads sort on click and reverse on a
second click. Lists open by name, A to Z, except the four that are
defined by an order (the longest, under 100 km, a week or less, one to
two weeks). The chosen order is kept in the page address. The pages are
written in their default order, so they are right without JavaScript.

Maps. A trail with no track but a known start and end is drawn as a
dotted straight line between the two with a ring at each; one with a
single known point is drawn as a ring. They follow the filters, the
row highlight and the popup like any track, and that trail's own page
shows a map in place of the empty frame. The legend, the caption and
the popup say the dotted line is not the trail's path. It gives no
download, no GPX status and no elevation.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-14 17:30:12 -07:00
1 parent d84116ce3a
commit 51baaa401e
15 files changed
+1049 -149

No files matched your search

+8 -11
View File
@@ -30,8 +30,9 @@ class List:
title: str
blurb: str
test: Callable[[dict], bool]
# Order within the list: longest first unless a list says otherwise.
order: Callable[[dict], object] = lambda r: -r["length_km"]
# The order the list opens in, a key of facets.SORTS. Name order unless
# the list is defined by an order (the longest, the shortest, a week).
sort: str = "name"
def _mi(km):
@@ -42,10 +43,6 @@ def _band(key):
return lambda r: facets.time_band(r) == key
def _days(r):
return facets.time_days(r)[1]
LISTS = (
List("national-scenic-trails", "National Scenic Trails",
"The long trails the United States Congress has named National Scenic Trails.",
@@ -54,16 +51,16 @@ LISTS = (
lambda r: facets.kind(r) == "route"),
List("longest", "The longest",
f"Trails of {LONG_KM:,} km ({_mi(LONG_KM)} mi) or more.",
lambda r: r["length_km"] >= LONG_KM),
lambda r: r["length_km"] >= LONG_KM, sort="length-desc"),
List("under-100-km", f"Under {SHORT_KM} km",
f"Trails shorter than {SHORT_KM} km ({_mi(SHORT_KM)} mi).",
lambda r: r["length_km"] < SHORT_KM, order=lambda r: r["length_km"]),
lambda r: r["length_km"] < SHORT_KM, sort="length-asc"),
List("a-week-or-less", "A week or less",
"Trails most people walk in a week or less, as a source states it or as estimated from the length.",
_band("week"), order=_days),
_band("week"), sort="time-asc"),
List("one-to-two-weeks", "One to two weeks",
"Trails that take one to two weeks, as a source states it or as estimated from the length.",
_band("two-weeks"), order=_days),
_band("two-weeks"), sort="time-asc"),
List("loops", "Loops", "Trails that finish where they start.",
lambda r: facets.shape(r) == "loop"),
List("with-gpx", "With a GPX to download",
@@ -84,7 +81,7 @@ LISTS = (
def members(lst, records):
return sorted((r for r in records if lst.test(r)), key=lambda r: (lst.order(r), r["name"]))
return facets.sort_records([r for r in records if lst.test(r)], lst.sort)
def is_shown(n, total):