gtfs-to-html 2.10.6 → 2.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -499,7 +499,7 @@ function formatTripNameForCSV(trip, timetable) {
499
499
  }
500
500
 
501
501
  // package.json
502
- var version = "2.10.6";
502
+ var version = "2.10.7";
503
503
 
504
504
  // src/lib/utils.ts
505
505
  var isTimepoint = (stoptime) => {
@@ -961,7 +961,9 @@ var getStopOrder = (timetable, config) => {
961
961
  timetable.orderedTrips,
962
962
  config
963
963
  );
964
- const stopIds = longestTripStoptimes.map((stoptime) => stoptime.stop_id);
964
+ const stopIds = longestTripStoptimes.map(
965
+ (stoptime) => stoptime.stop_id
966
+ );
965
967
  const missingStopIds = difference(
966
968
  uniq(
967
969
  timetable.orderedTrips.flatMap(
@@ -972,7 +974,7 @@ var getStopOrder = (timetable, config) => {
972
974
  );
973
975
  if (missingStopIds.length > 0) {
974
976
  timetable.warnings.push(
975
- `Timetable ${timetable.timetable_id} stops are unable to be topologically sorted and has no \`timetable_stop_order.txt\`. Falling back to using the using the stop order from trip with most stoptimes, but this does not include stop_ids ${new Intl.ListFormat("en", { style: "long", type: "conjunction" }).format(missingStopIds)}. Try manually specifying stops with \`timetable_stop_order.txt\`. Read more at https://gtfstohtml.com/docs/timetable-stop-order`
977
+ `Timetable ${timetable.timetable_id} stops are unable to be topologically sorted and has no \`timetable_stop_order.txt\`. Falling back to using the using the stop order from trip with most stoptimes, but this does not include stop_ids ${formatListForDisplay(missingStopIds)}. Try manually specifying stops with \`timetable_stop_order.txt\`. Read more at https://gtfstohtml.com/docs/timetable-stop-order`
976
978
  );
977
979
  }
978
980
  return duplicateStopsForDifferentArrivalDeparture(
@@ -1550,7 +1552,7 @@ function getFormattedTimetablePage(timetablePageId, config) {
1550
1552
  route_ids: uniqueRoutes.map((route) => route.route_id),
1551
1553
  agency_ids: uniq(compact(timetableRoutes.map((route) => route.agency_id))),
1552
1554
  filename: timetablePage.filename ?? `${timetablePage.timetable_page_id}.html`,
1553
- timetable_page_label: timetablePage.timetable_page_label ?? formatRouteNames(uniqueRoutes)
1555
+ timetable_page_label: timetablePage.timetable_page_label ?? formatListForDisplay(uniqueRoutes.map((route) => formatRouteName(route)))
1554
1556
  };
1555
1557
  return formattedTimetablePage;
1556
1558
  }
@@ -1582,7 +1584,7 @@ function generateTimetableHTML(timetablePage, config) {
1582
1584
  const templateVars = {
1583
1585
  timetablePage,
1584
1586
  config,
1585
- title: `${timetablePage.timetable_page_label} | ${formatAgencyNames(agencies)}`
1587
+ title: `${timetablePage.timetable_page_label} | ${formatListForDisplay(agencies.map((agency) => agency.agency_name))}`
1586
1588
  };
1587
1589
  return renderTemplate("timetablepage", templateVars, config);
1588
1590
  }
@@ -1649,11 +1651,12 @@ function generateOverviewHTML(timetablePages, config) {
1649
1651
  ...first(agencies),
1650
1652
  geojson
1651
1653
  },
1654
+ // Legacy agency object
1652
1655
  agencies,
1653
1656
  geojson,
1654
1657
  config,
1655
1658
  timetablePages: sortedTimetablePages,
1656
- title: `${formatAgencyNames(agencies)} Timetables`
1659
+ title: `${formatListForDisplay(agencies.map((agency) => agency.agency_name))} Timetables`
1657
1660
  };
1658
1661
  return renderTemplate("overview", templateVars, config);
1659
1662
  }
@@ -1989,17 +1992,11 @@ var formatRouteName = (route) => {
1989
1992
  }
1990
1993
  return route.route_long_name ?? "Unknown";
1991
1994
  };
1992
- var formatRouteNames = (routes) => {
1993
- return new Intl.ListFormat("en-US", {
1994
- style: "long",
1995
- type: "conjunction"
1996
- }).format(routes.map((route) => formatRouteName(route)));
1997
- };
1998
- var formatAgencyNames = (agencies) => {
1995
+ var formatListForDisplay = (list) => {
1999
1996
  return new Intl.ListFormat("en-US", {
2000
1997
  style: "long",
2001
1998
  type: "conjunction"
2002
- }).format(agencies.map((agency) => agency.agency_name));
1999
+ }).format(list);
2003
2000
  };
2004
2001
  function mergeTimetablesWithSameId(timetables) {
2005
2002
  if (timetables.length === 0) {