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.
package/dist/index.js CHANGED
@@ -501,7 +501,7 @@ function formatTripNameForCSV(trip, timetable) {
501
501
  }
502
502
 
503
503
  // package.json
504
- var version = "2.10.6";
504
+ var version = "2.10.7";
505
505
 
506
506
  // src/lib/utils.ts
507
507
  var isTimepoint = (stoptime) => {
@@ -963,7 +963,9 @@ var getStopOrder = (timetable, config) => {
963
963
  timetable.orderedTrips,
964
964
  config
965
965
  );
966
- const stopIds = longestTripStoptimes.map((stoptime) => stoptime.stop_id);
966
+ const stopIds = longestTripStoptimes.map(
967
+ (stoptime) => stoptime.stop_id
968
+ );
967
969
  const missingStopIds = difference(
968
970
  uniq(
969
971
  timetable.orderedTrips.flatMap(
@@ -974,7 +976,7 @@ var getStopOrder = (timetable, config) => {
974
976
  );
975
977
  if (missingStopIds.length > 0) {
976
978
  timetable.warnings.push(
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 ${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`
979
+ `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`
978
980
  );
979
981
  }
980
982
  return duplicateStopsForDifferentArrivalDeparture(
@@ -1552,7 +1554,7 @@ function getFormattedTimetablePage(timetablePageId, config) {
1552
1554
  route_ids: uniqueRoutes.map((route) => route.route_id),
1553
1555
  agency_ids: uniq(compact(timetableRoutes.map((route) => route.agency_id))),
1554
1556
  filename: timetablePage.filename ?? `${timetablePage.timetable_page_id}.html`,
1555
- timetable_page_label: timetablePage.timetable_page_label ?? formatRouteNames(uniqueRoutes)
1557
+ timetable_page_label: timetablePage.timetable_page_label ?? formatListForDisplay(uniqueRoutes.map((route) => formatRouteName(route)))
1556
1558
  };
1557
1559
  return formattedTimetablePage;
1558
1560
  }
@@ -1584,7 +1586,7 @@ function generateTimetableHTML(timetablePage, config) {
1584
1586
  const templateVars = {
1585
1587
  timetablePage,
1586
1588
  config,
1587
- title: `${timetablePage.timetable_page_label} | ${formatAgencyNames(agencies)}`
1589
+ title: `${timetablePage.timetable_page_label} | ${formatListForDisplay(agencies.map((agency) => agency.agency_name))}`
1588
1590
  };
1589
1591
  return renderTemplate("timetablepage", templateVars, config);
1590
1592
  }
@@ -1651,11 +1653,12 @@ function generateOverviewHTML(timetablePages, config) {
1651
1653
  ...first(agencies),
1652
1654
  geojson
1653
1655
  },
1656
+ // Legacy agency object
1654
1657
  agencies,
1655
1658
  geojson,
1656
1659
  config,
1657
1660
  timetablePages: sortedTimetablePages,
1658
- title: `${formatAgencyNames(agencies)} Timetables`
1661
+ title: `${formatListForDisplay(agencies.map((agency) => agency.agency_name))} Timetables`
1659
1662
  };
1660
1663
  return renderTemplate("overview", templateVars, config);
1661
1664
  }
@@ -1991,17 +1994,11 @@ var formatRouteName = (route) => {
1991
1994
  }
1992
1995
  return route.route_long_name ?? "Unknown";
1993
1996
  };
1994
- var formatRouteNames = (routes) => {
1995
- return new Intl.ListFormat("en-US", {
1996
- style: "long",
1997
- type: "conjunction"
1998
- }).format(routes.map((route) => formatRouteName(route)));
1999
- };
2000
- var formatAgencyNames = (agencies) => {
1997
+ var formatListForDisplay = (list) => {
2001
1998
  return new Intl.ListFormat("en-US", {
2002
1999
  style: "long",
2003
2000
  type: "conjunction"
2004
- }).format(agencies.map((agency) => agency.agency_name));
2001
+ }).format(list);
2005
2002
  };
2006
2003
  function mergeTimetablesWithSameId(timetables) {
2007
2004
  if (timetables.length === 0) {