gtfs-to-html 2.9.5 → 2.9.6
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/app/index.js +28 -5
- package/dist/app/index.js.map +1 -1
- package/dist/bin/gtfs-to-html.js +28 -5
- package/dist/bin/gtfs-to-html.js.map +1 -1
- package/dist/index.js +28 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/views/default/css/timetable_styles.css +41 -22
- package/views/default/formatting_functions.pug +0 -7
- package/views/default/layout.pug +1 -1
- package/views/default/overview.pug +1 -1
- package/views/default/timetablepage.pug +1 -1
package/dist/app/index.js
CHANGED
|
@@ -376,7 +376,7 @@ function getAgencyGeoJSON(config2) {
|
|
|
376
376
|
}
|
|
377
377
|
|
|
378
378
|
// package.json
|
|
379
|
-
var version = "2.9.
|
|
379
|
+
var version = "2.9.5";
|
|
380
380
|
|
|
381
381
|
// src/lib/utils.ts
|
|
382
382
|
var isTimepoint = (stoptime) => {
|
|
@@ -1387,6 +1387,7 @@ function getFormattedTimetablePage(timetablePageId, config2) {
|
|
|
1387
1387
|
});
|
|
1388
1388
|
}
|
|
1389
1389
|
}
|
|
1390
|
+
const uniqueRoutes = uniqBy(flatMap2(consolidatedTimetables, (timetable) => timetable.routes), "route_id");
|
|
1390
1391
|
const formattedTimetablePage = {
|
|
1391
1392
|
...timetablePage,
|
|
1392
1393
|
consolidatedTimetables,
|
|
@@ -1394,16 +1395,19 @@ function getFormattedTimetablePage(timetablePageId, config2) {
|
|
|
1394
1395
|
dayLists: uniq(
|
|
1395
1396
|
consolidatedTimetables.map((timetable) => timetable.dayList)
|
|
1396
1397
|
),
|
|
1397
|
-
route_ids:
|
|
1398
|
+
route_ids: uniqueRoutes.map((route) => route.route_id),
|
|
1398
1399
|
agency_ids: uniq(compact(timetableRoutes.map((route) => route.agency_id))),
|
|
1399
|
-
filename: timetablePage.filename ?? `${timetablePage.timetable_page_id}.html
|
|
1400
|
+
filename: timetablePage.filename ?? `${timetablePage.timetable_page_id}.html`,
|
|
1401
|
+
timetable_page_label: timetablePage.timetable_page_label ?? formatRouteNames(uniqueRoutes)
|
|
1400
1402
|
};
|
|
1401
1403
|
return formattedTimetablePage;
|
|
1402
1404
|
}
|
|
1403
1405
|
function generateTimetableHTML(timetablePage, config2) {
|
|
1406
|
+
const agencies = getAgencies();
|
|
1404
1407
|
const templateVars = {
|
|
1405
1408
|
timetablePage,
|
|
1406
|
-
config: config2
|
|
1409
|
+
config: config2,
|
|
1410
|
+
title: `${timetablePage.timetable_page_label} | ${formatAgencyNames(agencies)}`
|
|
1407
1411
|
};
|
|
1408
1412
|
return renderTemplate("timetablepage", templateVars, config2);
|
|
1409
1413
|
}
|
|
@@ -1442,7 +1446,8 @@ function generateOverviewHTML(timetablePages, config2) {
|
|
|
1442
1446
|
agencies,
|
|
1443
1447
|
geojson,
|
|
1444
1448
|
config: config2,
|
|
1445
|
-
timetablePages: sortedTimetablePages
|
|
1449
|
+
timetablePages: sortedTimetablePages,
|
|
1450
|
+
title: `${formatAgencyNames(agencies)} Timetables`
|
|
1446
1451
|
};
|
|
1447
1452
|
return renderTemplate("overview", templateVars, config2);
|
|
1448
1453
|
}
|
|
@@ -1763,6 +1768,24 @@ function formatTimetableLabel(timetable) {
|
|
|
1763
1768
|
}
|
|
1764
1769
|
return timetableLabel;
|
|
1765
1770
|
}
|
|
1771
|
+
var formatRouteName = (route) => {
|
|
1772
|
+
if (route.route_long_name === null || route.route_long_name === "") {
|
|
1773
|
+
return `Route ${route.route_short_name}`;
|
|
1774
|
+
}
|
|
1775
|
+
return route.route_long_name ?? "Unknown";
|
|
1776
|
+
};
|
|
1777
|
+
var formatRouteNames = (routes) => {
|
|
1778
|
+
return new Intl.ListFormat("en-US", {
|
|
1779
|
+
style: "long",
|
|
1780
|
+
type: "conjunction"
|
|
1781
|
+
}).format(routes.map((route) => formatRouteName(route)));
|
|
1782
|
+
};
|
|
1783
|
+
var formatAgencyNames = (agencies) => {
|
|
1784
|
+
return new Intl.ListFormat("en-US", {
|
|
1785
|
+
style: "long",
|
|
1786
|
+
type: "conjunction"
|
|
1787
|
+
}).format(agencies.map((agency) => agency.agency_name));
|
|
1788
|
+
};
|
|
1766
1789
|
function mergeTimetablesWithSameId(timetables) {
|
|
1767
1790
|
if (timetables.length === 0) {
|
|
1768
1791
|
return [];
|