Let a place carry its own label and preposition, keep the count in every place title, and test that slugs follow names

A registry entry may now set label and prep. A plateau reads "Plateau" and "on the Colorado
Plateau", the Mogollon Rim "Escarpment" and "along the Mogollon Rim", a national monument or a
parkway its own word; the default is still "Mountain range" and "in the". Every national park,
provincial park, monument, recreation area and parkway in the registry is labelled.

A place title no longer gives up its ": N Trails" ending when it is long: it drops the state first
and then keeps the count over the cap, and the state is left out where the name already holds
it (Oregon Cascades, California Coast Ranges). A test checks that every slug is the slug of its
display name, with the Arizona White Mountains as the one stated exception.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-20 12:28:03 -07:00
1 parent a97ea85093
commit 30d03b8069
10 files changed
+307 -43

No files matched your search

+3 -1
View File
@@ -422,7 +422,9 @@ One file at the top level, one `[[place]]` entry per place that at least one rec
| --- | --- | --- | --- |
| `slug` | string | The place's slug, unique within its kind. | `"wind-river-range"` |
| `kind` | string | `park`, `range` or `wilderness`. | `"range"` |
| `name` | string | The display name. | `"Wind River Range"` |
| `name` | string | The display name. The slug is the slug of this name (`white-mountains-arizona` is the one stated exception, as the other White Mountains have the plain slug). | `"Wind River Range"` |
| `label` | string, where present | What kind of place it is, for the page's kicker. Defaults to the kind's own: `Park`, `Mountain range`, `Wilderness area`. Set it where that is wrong: `Plateau` for the Colorado Plateau, `National monument` for a national monument. | `"Plateau"` |
| `prep` | string, where present | The preposition a title or lede uses for the place: `in the` (the default for a range or a wilderness area), `in` (the default for a park), `on the`, `along the`. | `"on the"` |
| `where` | array of strings | The state or province codes the place is in, as records write them (`"WY"`, `"ON"`). Proposed by the tool from the `regions` codes shared by at least half of the place's measured trails, and confirmed by a reviewer. | `["WY"]` |
| `within` | array of strings, where present | The slugs of parent places, ranges within ranges. Each names an existing `range` entry, and the chains never circle. A trail in a nested range is also in every parent; records never store the parents. | `["rocky-mountains"]` |
| `source` | string | Which published outline set the boundary came from: `nps`, `wilderness-connect`, `cpcad` or `gmba-v2`. | `"gmba-v2"` |
+105
View File
@@ -8,6 +8,7 @@
slug = "algonquin-provincial-park"
kind = "park"
name = "Algonquin Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350036900"
@@ -18,6 +19,7 @@ box = [-79.12, 45.18, -77.53, 46.15]
slug = "arches-national-park"
kind = "park"
name = "Arches National Park"
label = "National park"
where = ["UT"]
source = "nps"
source_id = "ARCH"
@@ -28,6 +30,7 @@ box = [-109.71, 38.6, -109.48, 38.85]
slug = "auyuittuq-national-park"
kind = "park"
name = "Auyuittuq National Park"
label = "National park"
where = ["NU"]
source = "cpcad"
source_id = "710200000"
@@ -38,6 +41,7 @@ box = [-68.23, 66.38, -63.81, 68.29]
slug = "banff-national-park"
kind = "park"
name = "Banff National Park"
label = "National park"
where = ["AB"]
source = "cpcad"
source_id = "710300000"
@@ -48,6 +52,7 @@ box = [-117.32, 50.71, -115.16, 52.27]
slug = "bayview-escarpment-provincial-park"
kind = "park"
name = "Bayview Escarpment Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350038000"
@@ -58,6 +63,7 @@ box = [-80.74, 44.62, -80.68, 44.65]
slug = "big-bend-national-park"
kind = "park"
name = "Big Bend National Park"
label = "National park"
where = ["TX"]
source = "nps"
source_id = "BIBE"
@@ -68,6 +74,7 @@ box = [-103.78, 28.97, -102.84, 29.69]
slug = "black-canyon-of-the-gunnison-national-park"
kind = "park"
name = "Black Canyon of the Gunnison National Park"
label = "National park"
where = ["CO"]
source = "nps"
source_id = "BLCA"
@@ -78,6 +85,8 @@ box = [-107.83, 38.5, -107.62, 38.64]
slug = "blue-ridge-parkway"
kind = "park"
name = "Blue Ridge Parkway"
label = "Parkway"
prep = "along the"
where = ["NC", "VA"]
source = "nps"
source_id = "BLRI"
@@ -88,6 +97,7 @@ box = [-83.3, 35.28, -78.86, 38.03]
slug = "boyne-valley-provincial-park"
kind = "park"
name = "Boyne Valley Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350037400"
@@ -98,6 +108,7 @@ box = [-80.15, 44.1, -80.1, 44.12]
slug = "bruce-peninsula-national-park"
kind = "park"
name = "Bruce Peninsula National Park"
label = "National park"
where = ["ON"]
source = "cpcad"
source_id = "710800000"
@@ -108,6 +119,7 @@ box = [-81.63, 45.07, -81.34, 45.25]
slug = "bryce-canyon-national-park"
kind = "park"
name = "Bryce Canyon National Park"
label = "National park"
where = ["UT"]
source = "nps"
source_id = "BRCA"
@@ -118,6 +130,7 @@ box = [-112.27, 37.44, -112.08, 37.7]
slug = "cabot-head-provincial-park"
kind = "park"
name = "Cabot Head Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350031600"
@@ -128,6 +141,7 @@ box = [-81.52, 45.16, -81.28, 45.25]
slug = "canyonlands-national-park"
kind = "park"
name = "Canyonlands National Park"
label = "National park"
where = ["UT"]
source = "nps"
source_id = "CANY"
@@ -138,6 +152,7 @@ box = [-110.24, 37.96, -109.66, 38.51]
slug = "cape-scott-park"
kind = "park"
name = "Cape Scott Park"
label = "Provincial park"
where = ["BC"]
source = "cpcad"
source_id = "590000250"
@@ -148,6 +163,7 @@ box = [-128.44, 50.65, -127.85, 50.88]
slug = "capitol-reef-national-park"
kind = "park"
name = "Capitol Reef National Park"
label = "National park"
where = ["UT"]
source = "nps"
source_id = "CARE"
@@ -158,6 +174,7 @@ box = [-111.42, 37.6, -110.86, 38.53]
slug = "carlsbad-caverns-national-park"
kind = "park"
name = "Carlsbad Caverns National Park"
label = "National park"
where = ["NM"]
source = "nps"
source_id = "CAVE"
@@ -168,6 +185,7 @@ box = [-104.68, 32.04, -104.37, 32.2]
slug = "castle-provincial-park"
kind = "park"
name = "Castle Provincial Park"
label = "Provincial park"
where = ["AB"]
source = "cpcad"
source_id = "480001158"
@@ -178,6 +196,7 @@ box = [-114.55, 49.34, -114.27, 49.55]
slug = "castle-wildland-provincial-park"
kind = "park"
name = "Castle Wildland Provincial Park"
label = "Wildland provincial park"
where = ["AB"]
source = "cpcad"
source_id = "480001148"
@@ -188,6 +207,7 @@ box = [-114.7, 49.16, -113.97, 49.63]
slug = "colorado-national-monument"
kind = "park"
name = "Colorado National Monument"
label = "National monument"
where = ["CO"]
source = "nps"
source_id = "COLM"
@@ -198,6 +218,7 @@ box = [-108.76, 38.98, -108.62, 39.12]
slug = "crater-lake-national-park"
kind = "park"
name = "Crater Lake National Park"
label = "National park"
where = ["OR"]
source = "nps"
source_id = "CRLA"
@@ -208,6 +229,7 @@ box = [-122.88, 42.33, -121.97, 43.09]
slug = "cuyahoga-valley-national-park"
kind = "park"
name = "Cuyahoga Valley National Park"
label = "National park"
where = ["OH"]
source = "nps"
source_id = "CUVA"
@@ -218,6 +240,7 @@ box = [-81.65, 41.09, -81.49, 41.42]
slug = "death-valley-national-park"
kind = "park"
name = "Death Valley National Park"
label = "National park"
where = ["CA", "NV"]
source = "nps"
source_id = "DEVA"
@@ -228,6 +251,7 @@ box = [-118.0, 35.59, -116.28, 37.35]
slug = "don-getty-wildland-provincial-park"
kind = "park"
name = "Don Getty Wildland Provincial Park"
label = "Wildland provincial park"
where = ["AB"]
source = "cpcad"
source_id = "480001114"
@@ -238,6 +262,7 @@ box = [-115.54, 50.09, -114.34, 51.62]
slug = "duncan-escarpment-provincial-park"
kind = "park"
name = "Duncan Escarpment Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350053400"
@@ -248,6 +273,7 @@ box = [-80.47, 44.41, -80.46, 44.43]
slug = "elk-lakes-park"
kind = "park"
name = "Elk Lakes Park"
label = "Provincial park"
where = ["BC"]
source = "cpcad"
source_id = "590000253"
@@ -258,6 +284,7 @@ box = [-115.21, 50.37, -114.99, 50.59]
slug = "forillon-national-park"
kind = "park"
name = "Forillon National Park"
label = "National park"
where = ["QC"]
source = "cpcad"
source_id = "712000000"
@@ -268,6 +295,7 @@ box = [-64.52, 48.75, -64.16, 48.99]
slug = "forks-of-the-credit-provincial-park"
kind = "park"
name = "Forks of the Credit Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350039700"
@@ -278,6 +306,7 @@ box = [-80.02, 43.8, -79.99, 43.83]
slug = "fort-bowie-national-historic-site"
kind = "park"
name = "Fort Bowie National Historic Site"
label = "National historic site"
where = ["AZ"]
source = "nps"
source_id = "FOBO"
@@ -288,6 +317,7 @@ box = [-109.48, 32.14, -109.43, 32.16]
slug = "frontenac-provincial-park"
kind = "park"
name = "Frontenac Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350052100"
@@ -298,6 +328,7 @@ box = [-76.56, 44.5, -76.46, 44.58]
slug = "gaspesie-national-park"
kind = "park"
name = "Gaspésie National Park"
label = "National park"
where = ["QC"]
source = "cpcad"
source_id = "240000123"
@@ -308,6 +339,7 @@ box = [-66.69, 48.83, -65.84, 49.12]
slug = "gates-of-the-arctic-national-park-and-preserve"
kind = "park"
name = "Gates of the Arctic National Park and Preserve"
label = "National park and preserve"
where = ["AK"]
source = "nps"
source_id = "GAAR"
@@ -318,6 +350,7 @@ box = [-157.0, 66.65, -149.53, 68.66]
slug = "glacier-national-park"
kind = "park"
name = "Glacier National Park"
label = "National park"
where = ["MT"]
source = "nps"
source_id = "GLAC"
@@ -328,6 +361,7 @@ box = [-114.47, 48.23, -113.24, 49.0]
slug = "glen-canyon-national-recreation-area"
kind = "park"
name = "Glen Canyon National Recreation Area"
label = "National recreation area"
where = ["AZ", "UT"]
source = "nps"
source_id = "GLCA"
@@ -338,6 +372,7 @@ box = [-111.66, 36.82, -109.95, 38.5]
slug = "grand-canyon-national-park"
kind = "park"
name = "Grand Canyon National Park"
label = "National park"
where = ["AZ"]
source = "nps"
source_id = "GRCA"
@@ -348,6 +383,7 @@ box = [-113.98, 35.75, -111.59, 36.87]
slug = "grand-teton-national-park"
kind = "park"
name = "Grand Teton National Park"
label = "National park"
where = ["WY"]
source = "nps"
source_id = "GRTE"
@@ -358,6 +394,7 @@ box = [-110.95, 43.54, -110.42, 44.08]
slug = "great-basin-national-park"
kind = "park"
name = "Great Basin National Park"
label = "National park"
where = ["NV"]
source = "nps"
source_id = "GRBA"
@@ -368,6 +405,7 @@ box = [-114.36, 38.82, -114.13, 39.06]
slug = "great-sand-dunes-national-park"
kind = "park"
name = "Great Sand Dunes National Park"
label = "National park"
where = ["CO"]
source = "nps"
source_id = "GRSA"
@@ -378,6 +416,7 @@ box = [-105.73, 37.66, -105.43, 37.96]
slug = "great-smoky-mountains-national-park"
kind = "park"
name = "Great Smoky Mountains National Park"
label = "National park"
where = ["NC", "TN"]
source = "nps"
source_id = "GRSM"
@@ -388,6 +427,7 @@ box = [-84.01, 35.43, -83.0, 35.84]
slug = "gros-morne-national-park"
kind = "park"
name = "Gros Morne National Park"
label = "National park"
where = ["NL"]
source = "cpcad"
source_id = "714100000"
@@ -398,6 +438,7 @@ box = [-58.15, 49.3, -57.41, 49.97]
slug = "guadalupe-mountains-national-park"
kind = "park"
name = "Guadalupe Mountains National Park"
label = "National park"
where = ["TX"]
source = "nps"
source_id = "GUMO"
@@ -408,6 +449,7 @@ box = [-105.03, 31.81, -104.71, 32.0]
slug = "hautes-gorges-de-la-riviere-malbaie-national-park"
kind = "park"
name = "Hautes-Gorges-de-la-Rivière-Malbaie National Park"
label = "National park"
where = ["QC"]
source = "cpcad"
source_id = "240004751"
@@ -418,6 +460,7 @@ box = [-70.68, 47.84, -70.35, 48.0]
slug = "height-of-the-rockies-park"
kind = "park"
name = "Height of the Rockies Park"
label = "Provincial park"
where = ["BC"]
source = "cpcad"
source_id = "590009185"
@@ -428,6 +471,7 @@ box = [-115.5, 50.24, -114.95, 50.73]
slug = "high-rock-wildland-provincial-park"
kind = "park"
name = "High Rock Wildland Provincial Park"
label = "Wildland provincial park"
where = ["AB"]
source = "cpcad"
source_id = "480001153"
@@ -438,6 +482,7 @@ box = [-114.69, 49.65, -114.53, 50.0]
slug = "hockley-valley-provincial-park"
kind = "park"
name = "Hockley Valley Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350036800"
@@ -448,6 +493,7 @@ box = [-80.08, 43.97, -80.05, 44.0]
slug = "hope-bay-forest-provincial-park"
kind = "park"
name = "Hope Bay Forest Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350057500"
@@ -458,6 +504,7 @@ box = [-81.18, 44.91, -81.14, 44.94]
slug = "inland-lake-park"
kind = "park"
name = "Inland Lake Park"
label = "Provincial park"
where = ["BC"]
source = "cpcad"
source_id = "590006197"
@@ -468,6 +515,7 @@ box = [-124.53, 49.91, -124.44, 50.0]
slug = "jasper-national-park"
kind = "park"
name = "Jasper National Park"
label = "National park"
where = ["AB"]
source = "cpcad"
source_id = "714700000"
@@ -478,6 +526,7 @@ box = [-119.55, 52.13, -116.8, 53.48]
slug = "joshua-tree-national-park"
kind = "park"
name = "Joshua Tree National Park"
label = "National park"
where = ["CA"]
source = "nps"
source_id = "JOTR"
@@ -488,6 +537,7 @@ box = [-116.46, 33.67, -115.26, 34.13]
slug = "kakwa-park"
kind = "park"
name = "Kakwa Park"
label = "Provincial park"
where = ["BC"]
source = "cpcad"
source_id = "590000345"
@@ -498,6 +548,7 @@ box = [-120.71, 53.79, -120.0, 54.3]
slug = "katahdin-woods-and-waters-national-monument"
kind = "park"
name = "Katahdin Woods and Waters National Monument"
label = "National monument"
where = ["ME"]
source = "nps"
source_id = "KAWW"
@@ -508,6 +559,7 @@ box = [-68.82, 45.83, -68.56, 46.13]
slug = "killarney-provincial-park"
kind = "park"
name = "Killarney Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350051800"
@@ -518,6 +570,7 @@ box = [-81.63, 45.99, -81.18, 46.2]
slug = "kluane-national-park-reserve"
kind = "park"
name = "Kluane National Park Reserve"
label = "National park reserve"
where = ["YT"]
source = "cpcad"
source_id = "715100000"
@@ -528,6 +581,7 @@ box = [-141.0, 60.0, -137.02, 61.33]
slug = "kluskoil-lake-park"
kind = "park"
name = "Kluskoil Lake Park"
label = "Provincial park"
where = ["BC"]
source = "cpcad"
source_id = "590007458"
@@ -538,6 +592,7 @@ box = [-124.14, 53.12, -123.68, 53.25]
slug = "komoka-provincial-park"
kind = "park"
name = "Komoka Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350037500"
@@ -548,6 +603,7 @@ box = [-81.42, 42.93, -81.38, 42.96]
slug = "kootenay-national-park"
kind = "park"
name = "Kootenay National Park"
label = "National park"
where = ["BC"]
source = "cpcad"
source_id = "715200000"
@@ -558,6 +614,7 @@ box = [-116.36, 50.58, -115.8, 51.31]
slug = "la-manche-provincial-park"
kind = "park"
name = "La Manche Provincial Park"
label = "Provincial park"
where = ["NL"]
source = "cpcad"
source_id = "100001401"
@@ -568,6 +625,7 @@ box = [-52.92, 47.16, -52.85, 47.2]
slug = "lake-mead-national-recreation-area"
kind = "park"
name = "Lake Mead National Recreation Area"
label = "National recreation area"
where = ["AZ", "NV"]
source = "nps"
source_id = "LAKE"
@@ -578,6 +636,7 @@ box = [-114.92, 35.17, -113.14, 36.59]
slug = "lassen-volcanic-national-park"
kind = "park"
name = "Lassen Volcanic National Park"
label = "National park"
where = ["CA"]
source = "nps"
source_id = "LAVO"
@@ -588,6 +647,7 @@ box = [-121.62, 40.34, -121.25, 40.59]
slug = "lions-head-provincial-park"
kind = "park"
name = "Lion's Head Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350039500"
@@ -598,6 +658,7 @@ box = [-81.24, 44.97, -81.19, 45.01]
slug = "malaspina-park"
kind = "park"
name = "Malaspina Park"
label = "Provincial park"
where = ["BC"]
source = "cpcad"
source_id = "590006268"
@@ -608,6 +669,7 @@ box = [-124.84, 50.01, -124.73, 50.06]
slug = "marine-drive-provincial-park"
kind = "park"
name = "Marine Drive Provincial Park"
label = "Provincial park"
where = ["NL"]
source = "cpcad"
source_id = "100002601"
@@ -618,6 +680,7 @@ box = [-52.83, 47.73, -52.79, 47.76]
slug = "mono-cliffs-provincial-park"
kind = "park"
name = "Mono Cliffs Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350060900"
@@ -628,6 +691,7 @@ box = [-80.09, 44.03, -80.06, 44.07]
slug = "mount-assiniboine-park"
kind = "park"
name = "Mount Assiniboine Park"
label = "Provincial park"
where = ["BC"]
source = "cpcad"
source_id = "590000005"
@@ -638,6 +702,7 @@ box = [-115.92, 50.82, -115.56, 51.09]
slug = "mount-carleton-provincial-park"
kind = "park"
name = "Mount Carleton Provincial Park"
label = "Provincial park"
where = ["NB"]
source = "cpcad"
source_id = "130001300"
@@ -648,6 +713,7 @@ box = [-66.97, 47.35, -66.69, 47.46]
slug = "mount-rainier-national-park"
kind = "park"
name = "Mount Rainier National Park"
label = "National park"
where = ["WA"]
source = "nps"
source_id = "MORA"
@@ -658,6 +724,7 @@ box = [-122.13, 46.71, -121.44, 47.1]
slug = "mount-robson-park"
kind = "park"
name = "Mount Robson Park"
label = "Provincial park"
where = ["BC"]
source = "cpcad"
source_id = "590000002"
@@ -668,6 +735,7 @@ box = [-119.43, 52.51, -118.27, 53.3]
slug = "murphys-point-provincial-park"
kind = "park"
name = "Murphys Point Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350052000"
@@ -678,6 +746,7 @@ box = [-76.27, 44.75, -76.2, 44.79]
slug = "naikoon-park"
kind = "park"
name = "Naikoon Park"
label = "Provincial park"
where = ["BC"]
source = "cpcad"
source_id = "590000255"
@@ -688,6 +757,7 @@ box = [-132.1, 53.57, -131.66, 54.15]
slug = "noisy-river-provincial-park"
kind = "park"
name = "Noisy River Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350049000"
@@ -698,6 +768,7 @@ box = [-80.22, 44.26, -80.17, 44.28]
slug = "north-cascades-national-park"
kind = "park"
name = "North Cascades National Park"
label = "National park"
where = ["WA"]
source = "nps"
source_id = "NOCA"
@@ -708,6 +779,7 @@ box = [-121.64, 48.37, -120.63, 49.0]
slug = "nottawasaga-lookout-provincial-park"
kind = "park"
name = "Nottawasaga Lookout Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350048500"
@@ -718,6 +790,7 @@ box = [-80.27, 44.4, -80.24, 44.41]
slug = "olympic-national-park"
kind = "park"
name = "Olympic National Park"
label = "National park"
where = ["WA"]
source = "nps"
source_id = "OLYM"
@@ -728,6 +801,7 @@ box = [-124.77, 47.47, -123.12, 48.38]
slug = "pacific-rim-national-park-reserve"
kind = "park"
name = "Pacific Rim National Park Reserve"
label = "National park reserve"
where = ["BC"]
source = "cpcad"
source_id = "716500000"
@@ -738,6 +812,7 @@ box = [-125.89, 48.54, -124.39, 49.12]
slug = "peter-lougheed-provincial-park"
kind = "park"
name = "Peter Lougheed Provincial Park"
label = "Provincial park"
where = ["AB"]
source = "cpcad"
source_id = "480001041"
@@ -748,6 +823,7 @@ box = [-115.4, 50.53, -114.92, 50.83]
slug = "pretty-river-valley-provincial-park"
kind = "park"
name = "Pretty River Valley Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350058400"
@@ -758,6 +834,7 @@ box = [-80.32, 44.41, -80.27, 44.45]
slug = "prince-edward-island-national-park"
kind = "park"
name = "Prince Edward Island National Park"
label = "National park"
where = ["PE"]
source = "cpcad"
source_id = "717200000"
@@ -768,6 +845,7 @@ box = [-63.5, 46.4, -62.65, 46.52]
slug = "queen-elizabeth-ii-wildlands-provincial-park"
kind = "park"
name = "Queen Elizabeth II Wildlands Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350057300"
@@ -778,6 +856,7 @@ box = [-79.21, 44.72, -78.8, 44.93]
slug = "redwood-national-park"
kind = "park"
name = "Redwood National Park"
label = "National park"
where = ["CA"]
source = "nps"
source_id = "REDW"
@@ -788,6 +867,7 @@ box = [-124.16, 41.08, -123.85, 41.84]
slug = "rocky-mountain-national-park"
kind = "park"
name = "Rocky Mountain National Park"
label = "National park"
where = ["CO"]
source = "nps"
source_id = "ROMO"
@@ -798,6 +878,7 @@ box = [-105.91, 40.16, -105.49, 40.55]
slug = "saguaro-national-park"
kind = "park"
name = "Saguaro National Park"
label = "National park"
where = ["AZ"]
source = "nps"
source_id = "SAGU"
@@ -808,6 +889,7 @@ box = [-111.24, 32.1, -110.5, 32.35]
slug = "schoen-lake-park"
kind = "park"
name = "Schoen Lake Park"
label = "Provincial park"
where = ["BC"]
source = "cpcad"
source_id = "590000283"
@@ -818,6 +900,7 @@ box = [-126.36, 50.14, -126.13, 50.23]
slug = "sequoia-and-kings-canyon-national-parks"
kind = "park"
name = "Sequoia and Kings Canyon National Parks"
label = "National parks"
where = ["CA"]
source = "nps"
source_id = ["SEQU", "KICA"]
@@ -828,6 +911,7 @@ box = [-118.98, 36.29, -118.23, 37.24]
slug = "shenandoah-national-park"
kind = "park"
name = "Shenandoah National Park"
label = "National park"
where = ["VA"]
source = "nps"
source_id = "SHEN"
@@ -838,6 +922,7 @@ box = [-78.86, 38.03, -78.15, 38.91]
slug = "short-hills-provincial-park"
kind = "park"
name = "Short Hills Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350059400"
@@ -848,6 +933,7 @@ box = [-79.31, 43.08, -79.26, 43.12]
slug = "smokey-head-white-bluff-provincial-park"
kind = "park"
name = "Smokey Head-White Bluff Provincial Park"
label = "Provincial park"
where = ["ON"]
source = "cpcad"
source_id = "350052600"
@@ -858,6 +944,7 @@ box = [-81.29, 45.05, -81.26, 45.09]
slug = "stein-valley-nlakapamux-heritage-park"
kind = "park"
name = "Stein Valley Nlaka'Pamux Heritage Park"
label = "Provincial heritage park"
where = ["BC"]
source = "cpcad"
source_id = "590009458"
@@ -868,6 +955,7 @@ box = [-122.32, 50.08, -121.63, 50.43]
slug = "strathcona-park"
kind = "park"
name = "Strathcona Park"
label = "Provincial park"
where = ["BC"]
source = "cpcad"
source_id = "590000001"
@@ -878,6 +966,7 @@ box = [-126.26, 49.38, -125.19, 50.02]
slug = "theodore-roosevelt-national-park"
kind = "park"
name = "Theodore Roosevelt National Park"
label = "National park"
where = ["ND"]
source = "nps"
source_id = "THRO"
@@ -888,6 +977,7 @@ box = [-103.63, 46.89, -103.24, 47.63]
slug = "titetown-park"
kind = "park"
name = "Titetown Park"
label = "Provincial park"
where = ["BC"]
source = "cpcad"
source_id = "590000592"
@@ -898,6 +988,7 @@ box = [-123.78, 53.27, -123.7, 53.3]
slug = "torngat-mountains-national-park"
kind = "park"
name = "Torngat Mountains National Park"
label = "National park"
where = ["NL"]
source = "cpcad"
source_id = "719000000"
@@ -908,6 +999,7 @@ box = [-64.94, 58.39, -62.63, 60.38]
slug = "tweedsmuir-park"
kind = "park"
name = "Tweedsmuir Park"
label = "Provincial park"
where = ["BC"]
source = "cpcad"
source_id = "590000019"
@@ -918,6 +1010,7 @@ box = [-127.37, 51.89, -125.58, 53.82]
slug = "waterton-lakes-national-park"
kind = "park"
name = "Waterton Lakes National Park"
label = "National park"
where = ["AB"]
source = "cpcad"
source_id = "719600000"
@@ -928,6 +1021,7 @@ box = [-114.17, 49.0, -113.65, 49.2]
slug = "willmore-wilderness-park"
kind = "park"
name = "Willmore Wilderness Park"
label = "Wilderness park"
where = ["AB"]
source = "cpcad"
source_id = "480001104"
@@ -938,6 +1032,7 @@ box = [-120.0, 53.35, -118.15, 54.02]
slug = "wind-cave-national-park"
kind = "park"
name = "Wind Cave National Park"
label = "National park"
where = ["SD"]
source = "nps"
source_id = "WICA"
@@ -948,6 +1043,7 @@ box = [-103.55, 43.5, -103.34, 43.64]
slug = "yellowstone-national-park"
kind = "park"
name = "Yellowstone National Park"
label = "National park"
where = ["ID", "MT", "WY"]
source = "nps"
source_id = "YELL"
@@ -958,6 +1054,7 @@ box = [-111.16, 44.13, -109.82, 45.11]
slug = "yoho-national-park"
kind = "park"
name = "Yoho National Park"
label = "National park"
where = ["BC"]
source = "cpcad"
source_id = "719900000"
@@ -968,6 +1065,7 @@ box = [-116.79, 51.1, -116.26, 51.66]
slug = "yosemite-national-park"
kind = "park"
name = "Yosemite National Park"
label = "National park"
where = ["CA"]
source = "nps"
source_id = "YOSE"
@@ -978,6 +1076,7 @@ box = [-119.89, 37.49, -119.2, 38.19]
slug = "zion-national-park"
kind = "park"
name = "Zion National Park"
label = "National park"
where = ["UT"]
source = "nps"
source_id = "ZION"
@@ -1020,6 +1119,8 @@ box = [-82.17, 37.34, -77.67, 41.1]
slug = "allegheny-plateau"
kind = "range"
name = "Allegheny Plateau"
label = "Plateau"
prep = "on the"
where = ["NY", "PA"]
within = ["appalachian-mountains"]
source = "gmba-v2"
@@ -1147,6 +1248,8 @@ box = [-137.29, 48.54, -121.39, 60.86]
slug = "colorado-plateau"
kind = "range"
name = "Colorado Plateau"
label = "Plateau"
prep = "on the"
where = ["AZ", "CO", "NM", "UT"]
source = "gmba-v2"
source_id = "12104"
@@ -1200,6 +1303,8 @@ box = [-109.61, 38.05, -108.8, 38.81]
slug = "mogollon-rim"
kind = "range"
name = "Mogollon Rim"
label = "Escarpment"
prep = "along the"
where = ["AZ"]
source = "gmba-v2"
source_id = "11633"
+8 -2
View File
@@ -15,11 +15,12 @@ import tomllib
KINDS = ("park", "range", "wilderness")
SOURCES = ("nps", "wilderness-connect", "cpcad", "gmba-v2")
REGISTRY_KEYS = {"slug", "kind", "name", "where", "within", "source", "source_id",
"source_version", "box"}
REGISTRY_KEYS = {"slug", "kind", "name", "label", "prep", "where", "within", "source",
"source_id", "source_version", "box"}
REGISTRY_REQUIRED = ("slug", "kind", "name", "where", "source", "source_id",
"source_version", "box")
PLACE_KEYS = {"kind", "slug", "basis", "km", "source"}
PREP_RE = re.compile(r"(in|on|at|along|across|near)( the)?")
ID_RE = re.compile(r"[a-z0-9]+(-[a-z0-9]+)*")
DATE_RE = re.compile(r"\d{4}-\d{2}-\d{2}")
HASH_RE = re.compile(r"[0-9a-f]{16}")
@@ -81,6 +82,11 @@ def check_registry(entries, errors):
errors.append(f"{where} kind must be park, range or wilderness, not {kind!r}")
if "name" in e:
_text(e, "name", where, errors)
if "label" in e:
_text(e, "label", where, errors)
if "prep" in e and not (isinstance(e["prep"], str) and PREP_RE.fullmatch(e["prep"])):
errors.append(f"{where} prep must be a preposition such as \"in the\", \"on the\" "
f"or \"along the\", not {e['prep']!r}")
where_codes = e.get("where")
if "where" in e and (not isinstance(where_codes, list) or not where_codes
or not all(isinstance(c, str) and c for c in where_codes)):
+6 -2
View File
@@ -1050,8 +1050,8 @@ def write_registry(root, entries):
lines.pop()
for e in sorted(entries, key=lambda e: (_KIND_ORDER.get(e["kind"], 9), e["slug"])):
lines += ["", "[[place]]"]
for key in ("slug", "kind", "name", "where", "within", "source", "source_id",
"source_version", "box"):
for key in ("slug", "kind", "name", "label", "prep", "where", "within", "source",
"source_id", "source_version", "box"):
if key in e and e[key] not in (None, [], ()):
lines.append(f"{key} = {refresh._scalar(e[key])}")
with open(path, "w", encoding="utf-8") as f:
@@ -1132,6 +1132,10 @@ def apply(proposal_path, root, today, exclude=frozenset()):
"where": old.get("where") or v["where"],
"source": v["source"], "source_id": v["source_id"],
"source_version": versions.get(v["source"], ""), "box": v["box"]}
# a reviewed label and preposition ("Plateau", "on the") are kept too
for kept in ("label", "prep"):
if old.get(kept):
entry[kept] = old[kept]
if v.get("within"):
entry["within"] = list(v["within"])
entries.append(entry)
+10
View File
@@ -605,6 +605,16 @@ class ApplyTest(unittest.TestCase):
P.apply(self.pjson, self.root, "2026-12-01")
self.assertEqual(read_toml(path)["place"][0]["where"], ["MT", "WY"])
def test_a_reviewed_label_and_preposition_survive_a_rerun(self):
P.apply(self.pjson, self.root, "2026-11-20")
path = os.path.join(self.root, "places.toml")
text = open(path).read()
open(path, "w").write(text.replace('name = "Alpha Park"',
'name = "Alpha Park"\nlabel = "National park"\nprep = "along the"'))
P.apply(self.pjson, self.root, "2026-12-01")
entry = read_toml(path)["place"][0]
self.assertEqual((entry["label"], entry["prep"]), ("National park", "along the"))
def test_stated_requires_an_http_source_a_quote_and_a_trackless_record(self):
P.apply(self.pjson, self.root, "2026-11-20")
with self.assertRaises(ValueError):
+39
View File
@@ -86,6 +86,45 @@ class RegistryTest(unittest.TestCase):
self.assertTrue(any("box" in m for m in registry_errors([entry(box=bad)])), bad)
class LabelAndPrepositionTest(unittest.TestCase):
def test_a_label_and_a_preposition_are_allowed_and_checked(self):
self.assertEqual(registry_errors([entry(label="Plateau", prep="on the")]), [])
self.assertEqual(registry_errors([entry(label="Parkway", prep="along the", kind="park")]), [])
self.assertTrue(any("label" in m for m in registry_errors([entry(label="")])))
self.assertTrue(any("label" in m for m in registry_errors([entry(label=3)])))
self.assertTrue(any("prep" in m for m in registry_errors([entry(prep="over the hills")])))
self.assertTrue(any("prep" in m for m in registry_errors([entry(prep="")])))
def test_every_place_that_is_not_a_mountain_range_names_its_own_label(self):
with open(os.path.join(ROOT, "places.toml"), "rb") as f:
import tomllib
reg = tomllib.load(f)["place"]
for e in reg:
if e["kind"] == "park":
self.assertTrue(e.get("label"), f"{e['slug']} needs a label")
by = {e["slug"]: e for e in reg if e["kind"] == "range"}
for slug in ("colorado-plateau", "allegheny-plateau"):
self.assertEqual((by[slug]["label"], by[slug]["prep"]), ("Plateau", "on the"))
self.assertEqual(by["mogollon-rim"]["prep"], "along the")
self.assertNotEqual(by["mogollon-rim"].get("label"), "Mountain range")
class SlugTest(unittest.TestCase):
EXCEPTIONS = {("range", "white-mountains-arizona"): "the White Mountains of Arizona share a "
"display name with the ones of New Hampshire and Maine"}
def test_every_slug_is_the_slugified_display_name(self):
import tomllib
import place_trails
with open(os.path.join(ROOT, "places.toml"), "rb") as f:
reg = tomllib.load(f)["place"]
bad = [f"{e['kind']}/{e['slug']} (name {e['name']!r})" for e in reg
if (e["kind"], e["slug"]) not in self.EXCEPTIONS
and e["slug"] != place_trails.slugify(e["name"])]
self.assertEqual(bad, [])
self.assertEqual(len(self.EXCEPTIONS), 1)
class RecordTest(unittest.TestCase):
def test_record_place_must_be_in_the_registry(self):
rec = record(place=[{"kind": "range", "slug": "no-such", "basis": "stated",
+18 -17
View File
@@ -19,19 +19,15 @@ def _in_name(info):
return places.in_name(info)
def _title_place(info):
"""The name in a page's title: _in_name with its one state spelled out for a
range or wilderness area (places.title_name), "the Wind River Range, Wyoming"."""
text = places.title_name(info)
if info["kind"] in ("range", "wilderness") and not text.lower().startswith("the "):
return f"the {text}"
return text
def _phrase(info):
""""in the Wind River Range", "on the Colorado Plateau", "along the Mogollon Rim"."""
return places.in_phrase(info)
def _kicker(info):
noun = places.KINDS[info["kind"]].noun
label = info.get("label") or places.label_of(info)
names = places.state_names(info)
return f"{noun} · {words.join_names(names)}" if names else noun
return f"{label} · {words.join_names(names)}" if names else label
def _crumbs(info):
@@ -39,12 +35,17 @@ def _crumbs(info):
def _lede(info, recs, n_gpx):
return f"{regions._plural(len(recs))} in {esc(_in_name(info))}, {n_gpx} with a GPX here."
return f"{regions._plural(len(recs))} {esc(_phrase(info))}, {n_gpx} with a GPX here."
def _title_options(info, recs, site):
base = f"Long Hikes in {_title_place(info)}"
return [f"{base}: {regions._plural(len(recs), 'Trail')}", base]
"""Every title keeps the count of trails. The state goes first when the title is too long
(and is never there when the name already holds it); a title that is still over the cap
keeps its count rather than lose it. "Long Hikes" and the preposition are never cut."""
count = regions._plural(len(recs), "Trail")
prep = places.prep_of(info)
return [f"Long Hikes {prep} {info['title_name']}: {count}",
f"Long Hikes {prep} {info['name']}: {count}"]
def _description(info, recs):
@@ -58,15 +59,15 @@ def _description(info, recs):
if n_gpx else "")
by_length = sorted(recs, key=lambda r: (r["length_km"], r["id"]))
# No state keys: a trail that runs on out of the place is never sized as the place's.
first = (f"{what} in {_title_place(info)}, from {common.plain_name(by_length[0])}, "
first = (f"{what} {places.prep_of(info)} {info['title_name']}, from {common.plain_name(by_length[0])}, "
f"{regions.trail_miles(by_length[0], ())}, to {common.plain_name(by_length[-1])}, "
f"{regions.trail_miles(by_length[-1], ())}.")
return regions._fit([first + gpx, first, f"{what} in {_title_place(info)}.{gpx}"])
return regions._fit([first + gpx, first, f"{what} {places.prep_of(info)} {info['title_name']}.{gpx}"])
def _nav(info, records, recs, facet_pages):
return (regions._lists_nav(_in_name(info), recs, records)
+ regions._facet_nav(_in_name(info), facet_pages))
return (regions._lists_nav(_in_name(info), recs, records, _phrase(info))
+ regions._facet_nav(_in_name(info), facet_pages, _phrase(info)))
def _kind():
@@ -74,7 +75,7 @@ def _kind():
kicker=_kicker, crumbs=_crumbs, lede=_lede, where="all", wholly=False,
facts_place=lambda info: (_in_name(info), ()), title_options=_title_options,
description=_description, box=lambda info: info.get("box"), nav=_nav,
in_name=_in_name)
in_name=_in_name, phrase=_phrase)
PARK = _kind()
+34 -9
View File
@@ -99,24 +99,48 @@ def state_names(info):
return [words.region_name(_state_key(c).split("-", 1)[-1]) for c in info.get("where") or []]
DEFAULT_PREP = {"park": "in", "range": "in the", "wilderness": "in the"}
def label_of(entry_or_info):
"""The page's kind word, from the registry's `label` or else the kind's own."""
return entry_or_info.get("label") or KINDS[entry_or_info["kind"]].noun
def prep_of(entry_or_info):
"""The preposition a title or lede uses, from the registry's `prep` or else the kind's own:
"in the" for a range or a wilderness area, "in" for a park; "on the Colorado Plateau",
"along the Mogollon Rim" where the registry says so."""
return entry_or_info.get("prep") or DEFAULT_PREP[entry_or_info["kind"]]
def in_name(info):
"""The name as it reads after "in": a range or a wilderness area takes "the"
("in the Wind River Range"), a park does not ("in Yosemite National Park")."""
"""The name as it reads after a verb or "through" ("the Wind River Range"): with "the"
when the place's preposition has one, as the plain name where it has not."""
name = info["name"]
if info.get("kind") in ("range", "wilderness") and not name.lower().startswith("the "):
if prep_of(info).endswith(" the") and not name.lower().startswith("the "):
return f"the {name}"
return name
def in_phrase(info):
"""The preposition and the name, as a title or a lede has it: "in the Wind River Range",
"on the Colorado Plateau", "along the Mogollon Rim", "in Yosemite National Park"."""
return f"{prep_of(info)} {info['name']}"
def title_name(info):
"""The place as a page title names it: a park by its name alone; a range or a
wilderness area in one state or province with that state spelled out
("Wind River Range, Wyoming"), and with no state when it spans several."""
"""The place as a page title names it: a park by its name alone; a range or a wilderness
area in one state or province with that state spelled out ("Wind River Range, Wyoming"),
with no state when it spans several or when the name already holds it ("Oregon Cascades",
"California Coast Ranges")."""
name = info["name"]
if info.get("kind") == "park":
return name
names = state_names(info)
return f"{name}, {names[0]}" if len(names) == 1 else name
if len(names) == 1 and names[0].lower() not in name.lower():
return f"{name}, {names[0]}"
return name
_NAME_ENDS = (" national park", " provincial park", " wilderness area", " park", " wilderness")
@@ -162,8 +186,8 @@ def _same_stem(park_name, range_name):
def collect(records, registry):
"""(kind, slug) -> info for every place with a page: PAGE_MIN or more trails.
An info holds kind, slug, key ("<kind>/<slug>"), name, where, box, records, path
and title_name. A wilderness area or a mountain range that holds exactly the
An info holds kind, slug, key ("<kind>/<slug>"), name, label, prep, where, box,
records, path and title_name. A wilderness area or a mountain range that holds exactly the
trails of a park of much the same name gets no page: one page for the one set, under
the park. The registry normally already leaves such a place out; the builder stays safe."""
mem = membership(records, registry)
@@ -173,6 +197,7 @@ def collect(records, registry):
continue
e = registry[(kind, slug)]
info = {"kind": kind, "slug": slug, "key": f"{kind}/{slug}", "name": e.get("name", slug),
"label": label_of(e), "prep": prep_of(e),
"where": list(e.get("where") or []), "box": e.get("box"), "records": recs,
"path": path(kind, slug)}
info["title_name"] = title_name(info)
+18 -11
View File
@@ -292,8 +292,10 @@ class PageKind:
title_options(info, recs, site) -> titles, fullest first, for common.fit_title.
description(info, recs) -> str. box(info) -> [west, south, east, north] or None.
nav(info, records, recs, facet_pages) -> HTML after the rows and map.
in_name(info) -> str, where present: the name as it reads after "in" ("the Wind
River Range"); the plain name where the kind leaves it out."""
in_name(info) -> str, where present: the name as it reads after a verb ("the Wind
River Range"); the plain name where the kind leaves it out. phrase(info) -> str,
where present: the preposition and the name ("on the Colorado Plateau"); where the
kind leaves it out, "in" and in_name."""
kicker: object
crumbs: object
lede: object
@@ -305,6 +307,7 @@ class PageKind:
box: object
nav: object
in_name: object = None
phrase: object = None
def _state_kicker(info):
@@ -360,21 +363,24 @@ def _state_description(info, recs):
return _fit([first + gpx, first, f"{what[:1].upper() + what[1:]} in {name}, {country}.{gpx}"])
def _lists_nav(name, recs, records):
"""The nav of ready-made lists holding some of these trails, shared by the kinds."""
def _lists_nav(name, recs, records, phrase=None):
"""The nav of ready-made lists holding some of these trails, shared by the kinds.
phrase is "in <name>" unless the place has its own preposition."""
held = lists_here(recs, records)
if not held:
return ""
return (f'<nav class="region-nav" aria-label="Lists with trails in {esc(name)}">'
f'Lists with trails in {esc(name)}, and how many here: {" · ".join(held)}</nav>')
phrase = phrase or f"in {name}"
return (f'<nav class="region-nav" aria-label="Lists with trails {esc(phrase)}">'
f'Lists with trails {esc(phrase)}, and how many here: {" · ".join(held)}</nav>')
def _facet_nav(name, facet_pages):
def _facet_nav(name, facet_pages, phrase=None):
"""The nav of this place's pages of one kind of trail, shared by the kinds."""
if not facet_pages:
return ""
return (f'<nav class="region-nav" aria-label="Kinds of trail in {esc(name)}">'
f'More in {esc(name)}: '
phrase = phrase or f"in {name}"
return (f'<nav class="region-nav" aria-label="Kinds of trail {esc(phrase)}">'
f'More {esc(phrase)}: '
+ " · ".join(f'<a href="{esc(path)}">{esc(label)}</a> ({n})' for label, path, n in facet_pages)
+ "</nav>")
@@ -415,6 +421,7 @@ def place_page(info, records, site, kind, *, facet_pages=(), place_links=""):
place = kind.facts_place(info)
wholly = wholly_in(recs, place[1]) if kind.wholly else None
in_name = kind.in_name(info) if kind.in_name else info["name"]
phrase = kind.phrase(info) if kind.phrase else f"in {in_name}"
body = f"""<div class="page-head"><div class="container">
<nav class="breadcrumb" aria-label="Breadcrumb"><ol>{crumbs}<li aria-current="page">{esc(info["name"])}</li></ol></nav>
<header class="titleblock"><div class="titleblock__text">
@@ -424,9 +431,9 @@ def place_page(info, records, site, kind, *, facet_pages=(), place_links=""):
</div></header>
</div></div>
<div class="container section place">
{home.browse_view(home.listing(recs, top=2, where=kind.where, wholly=wholly), home.overview_map(recs, f"Map of the trails in {in_name}", place=kind.box(info)),
{home.browse_view(home.listing(recs, top=2, where=kind.where, wholly=wholly), home.overview_map(recs, f"Map of the trails {phrase}", place=kind.box(info)),
about=f"{summary.facts(recs, records, place=place)}{summary.details(recs)}",
about_title=f"About the trails in {in_name}")}
about_title=f"About the trails {phrase}")}
{nav}{place_links}
</div>"""
title = common.fit_title(kind.title_options(info, recs, site), site)
+66 -1
View File
@@ -39,7 +39,8 @@ def write_registry(root, entries=REGISTRY):
box = ", ".join(str(v) for v in e["box"])
where = ", ".join(f'"{c}"' for c in e["where"])
within = f'\nwithin = [{", ".join(chr(34) + s + chr(34) for s in e["within"])}]' if e.get("within") else ""
lines.append(f'[[place]]\nslug = "{e["slug"]}"\nkind = "{e["kind"]}"\nname = "{e["name"]}"\n'
extra = "".join(f'{k} = "{e[k]}"\n' for k in ("label", "prep") if e.get(k))
lines.append(f'[[place]]\nslug = "{e["slug"]}"\nkind = "{e["kind"]}"\nname = "{e["name"]}"\n{extra}'
f'where = [{where}]{within}\nsource = "{e["source"]}"\nsource_id = "{e["source_id"]}"\n'
f'source_version = "{e["source_version"]}"\nbox = [{box}]\n')
with open(os.path.join(root, "places.toml"), "w", encoding="utf-8") as f:
@@ -85,6 +86,70 @@ def text(fragment):
return re.sub(r"\s+", " ", html.unescape(re.sub(r"<[^>]+>", " ", str(fragment))))
def entry_of(kind, slug, name, where, **kw):
return dict({"kind": kind, "slug": slug, "name": name, "where": where, "source": "gmba-v2",
"source_id": "1", "source_version": "2026-11-20", "box": BOX}, **kw)
def built_with(entries, n=3, regs=("WY",)):
records = [rec(300 + i, f"Place Trail {chr(64 + i)}", [(e["kind"], e["slug"]) for e in entries],
regs=regs) for i in range(1, n + 1)]
with tempfile.TemporaryDirectory() as d:
write_registry(d, entries)
return {b.path: b for b in placepages.build(records, S, d)}
class LabelPrepositionAndTitleTest(unittest.TestCase):
def test_a_plateau_is_not_a_mountain_range_and_is_on_not_in(self):
built = built_with([entry_of("range", "colorado-plateau", "Colorado Plateau", ["UT"],
label="Plateau", prep="on the")], regs=("UT",))
b = built["/ranges/colorado-plateau/"]
body = str(b.body)
self.assertEqual(b.title, "Long Hikes on the Colorado Plateau, Utah: 3 Trails")
self.assertIn('<p class="kicker">Plateau · Utah</p>', body)
self.assertNotIn("Mountain range", body)
self.assertIn("3 trails on the Colorado Plateau", text(body))
self.assertIn("on the Colorado Plateau", b.description)
self.assertNotIn("in the Colorado Plateau", body)
def test_the_rim_is_along_and_a_range_with_no_label_keeps_the_defaults(self):
built = built_with([entry_of("range", "mogollon-rim", "Mogollon Rim", ["AZ"],
label="Escarpment", prep="along the"),
entry_of("range", "wind-river-range", "Wind River Range", ["WY"])],
regs=("AZ", "WY"))
self.assertIn("3 trails along the Mogollon Rim", text(built["/ranges/mogollon-rim/"].body))
wind = built["/ranges/wind-river-range/"]
self.assertIn('<p class="kicker">Mountain range · Wyoming</p>', str(wind.body))
self.assertIn("3 trails in the Wind River Range", text(wind.body))
def test_a_park_has_its_own_label_and_no_the(self):
built = built_with([entry_of("park", "blue-ridge-parkway", "Blue Ridge Parkway", ["NC", "VA"],
label="Parkway", prep="along the")], regs=("NC",))
b = built["/parks/blue-ridge-parkway/"]
self.assertIn('<p class="kicker">Parkway · North Carolina and Virginia</p>', str(b.body))
self.assertEqual(b.title, "Long Hikes along the Blue Ridge Parkway: 3 Trails")
def test_a_state_already_in_the_name_is_not_repeated(self):
built = built_with([entry_of("range", "oregon-cascades", "Oregon Cascades", ["OR"]),
entry_of("range", "california-coast-ranges", "California Coast Ranges", ["CA"])],
regs=("OR", "CA"))
self.assertEqual(built["/ranges/oregon-cascades/"].title, "Long Hikes in the Oregon Cascades: 3 Trails")
self.assertEqual(built["/ranges/california-coast-ranges/"].title,
"Long Hikes in the California Coast Ranges: 3 Trails")
def test_every_place_title_keeps_its_count_even_with_a_long_name(self):
built = built_with([entry_of("range", "vancouver-island-ranges", "Vancouver Island Ranges", ["BC"]),
entry_of("park", "sequoia", "Sequoia and Kings Canyon National Parks", ["CA"]),
entry_of("wilderness", "sk", "Sequoia-Kings Canyon Wilderness", ["CA"])],
n=18, regs=("BC", "CA"))
for b in built.values():
self.assertTrue(b.title.endswith(": 18 Trails"), b.title)
self.assertTrue(b.title.startswith("Long Hikes in "), b.title)
# the state goes first, then nothing else: no "Long Hikes in" is shortened
self.assertEqual(built["/ranges/vancouver-island-ranges/"].title,
"Long Hikes in the Vancouver Island Ranges: 18 Trails")
class PlacePageTest(unittest.TestCase):
@classmethod
def setUpClass(cls):