gtfs-to-html 2.12.3 → 2.12.4
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 +64 -30
- package/dist/app/index.js.map +1 -1
- package/dist/bin/gtfs-to-html.js +64 -30
- package/dist/bin/gtfs-to-html.js.map +1 -1
- package/dist/frontend_libraries/maplibre-gl-geocoder.js +99 -103
- package/dist/frontend_libraries/maplibre-gl.js +4 -4
- package/dist/index.js +64 -30
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
- package/views/default/css/timetable_styles.css +1 -1
- package/views/default/formatting_functions.pug +1 -1
package/dist/bin/gtfs-to-html.js
CHANGED
|
@@ -112,6 +112,27 @@ function calendarToDateList(calendar, startDate, endDate) {
|
|
|
112
112
|
}
|
|
113
113
|
return Array.from(dates);
|
|
114
114
|
}
|
|
115
|
+
function combineCalendars(calendars) {
|
|
116
|
+
const combinedCalendar = {
|
|
117
|
+
monday: 0,
|
|
118
|
+
tuesday: 0,
|
|
119
|
+
wednesday: 0,
|
|
120
|
+
thursday: 0,
|
|
121
|
+
friday: 0,
|
|
122
|
+
saturday: 0,
|
|
123
|
+
sunday: 0
|
|
124
|
+
};
|
|
125
|
+
for (const calendar of calendars) {
|
|
126
|
+
for (const day of Object.keys(
|
|
127
|
+
combinedCalendar
|
|
128
|
+
)) {
|
|
129
|
+
if (calendar[day] === 1) {
|
|
130
|
+
combinedCalendar[day] = 1;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return combinedCalendar;
|
|
135
|
+
}
|
|
115
136
|
function secondsAfterMidnight(timeString) {
|
|
116
137
|
return moment.duration(timeString).asSeconds();
|
|
117
138
|
}
|
|
@@ -522,7 +543,7 @@ function formatTripNameForCSV(trip, timetable) {
|
|
|
522
543
|
// package.json
|
|
523
544
|
var package_default = {
|
|
524
545
|
name: "gtfs-to-html",
|
|
525
|
-
version: "2.12.
|
|
546
|
+
version: "2.12.4",
|
|
526
547
|
private: false,
|
|
527
548
|
description: "Build human readable transit timetables as HTML, PDF or CSV from GTFS",
|
|
528
549
|
keywords: [
|
|
@@ -572,26 +593,26 @@ var package_default = {
|
|
|
572
593
|
postinstall: "node scripts/postinstall.js"
|
|
573
594
|
},
|
|
574
595
|
dependencies: {
|
|
575
|
-
"@maplibre/maplibre-gl-geocoder": "^1.9.
|
|
576
|
-
"@turf/helpers": "^7.3.
|
|
577
|
-
"@turf/simplify": "^7.3.
|
|
596
|
+
"@maplibre/maplibre-gl-geocoder": "^1.9.4",
|
|
597
|
+
"@turf/helpers": "^7.3.2",
|
|
598
|
+
"@turf/simplify": "^7.3.2",
|
|
578
599
|
anchorme: "^3.0.8",
|
|
579
600
|
archiver: "^7.0.1",
|
|
580
601
|
"cli-table": "^0.3.11",
|
|
581
602
|
"css.escape": "^1.5.1",
|
|
582
603
|
"csv-stringify": "^6.6.0",
|
|
583
604
|
express: "^5.2.1",
|
|
584
|
-
gtfs: "^4.18.
|
|
605
|
+
gtfs: "^4.18.3",
|
|
585
606
|
"gtfs-realtime-pbf-js-module": "^1.0.0",
|
|
586
607
|
"js-beautify": "^1.15.4",
|
|
587
|
-
"lodash-es": "^4.17.
|
|
588
|
-
"maplibre-gl": "^5.
|
|
608
|
+
"lodash-es": "^4.17.23",
|
|
609
|
+
"maplibre-gl": "^5.16.0",
|
|
589
610
|
marked: "^17.0.1",
|
|
590
611
|
moment: "^2.30.1",
|
|
591
612
|
pbf: "^4.0.1",
|
|
592
613
|
"pretty-error": "^4.0.0",
|
|
593
614
|
pug: "^3.0.3",
|
|
594
|
-
puppeteer: "^24.
|
|
615
|
+
puppeteer: "^24.35.0",
|
|
595
616
|
"sanitize-filename": "^1.6.3",
|
|
596
617
|
"sanitize-html": "^2.17.0",
|
|
597
618
|
sqlstring: "^2.3.3",
|
|
@@ -607,7 +628,7 @@ var package_default = {
|
|
|
607
628
|
"@types/js-beautify": "^1.14.3",
|
|
608
629
|
"@types/lodash-es": "^4.17.12",
|
|
609
630
|
"@types/morgan": "^1.9.10",
|
|
610
|
-
"@types/node": "^
|
|
631
|
+
"@types/node": "^25",
|
|
611
632
|
"@types/pug": "^2.0.10",
|
|
612
633
|
"@types/sanitize-html": "^2.16.0",
|
|
613
634
|
"@types/sqlstring": "^2.3.2",
|
|
@@ -615,7 +636,7 @@ var package_default = {
|
|
|
615
636
|
"@types/yargs": "^17.0.35",
|
|
616
637
|
husky: "^9.1.7",
|
|
617
638
|
"lint-staged": "^16.2.7",
|
|
618
|
-
prettier: "^3.
|
|
639
|
+
prettier: "^3.8.1",
|
|
619
640
|
tsup: "^8.5.1",
|
|
620
641
|
typescript: "^5.9.3"
|
|
621
642
|
},
|
|
@@ -696,6 +717,16 @@ var deduplicateTrips = (trips) => {
|
|
|
696
717
|
).join("|");
|
|
697
718
|
if (!uniqueTrips.has(tripSignature)) {
|
|
698
719
|
uniqueTrips.set(tripSignature, trip);
|
|
720
|
+
} else {
|
|
721
|
+
const existingTrip = uniqueTrips.get(tripSignature);
|
|
722
|
+
if (!existingTrip) {
|
|
723
|
+
continue;
|
|
724
|
+
}
|
|
725
|
+
if (!existingTrip.additional_service_ids) {
|
|
726
|
+
existingTrip.additional_service_ids = [];
|
|
727
|
+
}
|
|
728
|
+
existingTrip.additional_service_ids.push(trip.service_id);
|
|
729
|
+
uniqueTrips.set(tripSignature, existingTrip);
|
|
699
730
|
}
|
|
700
731
|
}
|
|
701
732
|
return Array.from(uniqueTrips.values());
|
|
@@ -1377,7 +1408,7 @@ var addTripContinuation = (trip, timetable) => {
|
|
|
1377
1408
|
trip.continues_as_route = nextTrip;
|
|
1378
1409
|
}
|
|
1379
1410
|
};
|
|
1380
|
-
var filterTrips = (timetable, config) => {
|
|
1411
|
+
var filterTrips = (timetable, calendars, config) => {
|
|
1381
1412
|
let filteredTrips = timetable.orderedTrips;
|
|
1382
1413
|
for (const trip of filteredTrips) {
|
|
1383
1414
|
const combinedStoptimes = [];
|
|
@@ -1404,7 +1435,26 @@ var filterTrips = (timetable, config) => {
|
|
|
1404
1435
|
if (config.showDuplicateTrips === false) {
|
|
1405
1436
|
filteredTrips = deduplicateTrips(filteredTrips);
|
|
1406
1437
|
}
|
|
1407
|
-
|
|
1438
|
+
const formattedTrips = filteredTrips.map((trip) => {
|
|
1439
|
+
const tripCalendars = calendars.filter((calendar) => {
|
|
1440
|
+
return [
|
|
1441
|
+
trip.service_id,
|
|
1442
|
+
...trip.additional_service_ids || []
|
|
1443
|
+
].includes(calendar.service_id);
|
|
1444
|
+
}) ?? [];
|
|
1445
|
+
trip.dayList = formatDays(combineCalendars(tripCalendars), config);
|
|
1446
|
+
trip.dayListLong = formatDaysLong(trip.dayList, config);
|
|
1447
|
+
if (timetable.routes.length === 1) {
|
|
1448
|
+
trip.route_short_name = timetable.routes[0].route_short_name;
|
|
1449
|
+
} else {
|
|
1450
|
+
const route = timetable.routes.find(
|
|
1451
|
+
(route2) => route2.route_id === trip.route_id
|
|
1452
|
+
);
|
|
1453
|
+
trip.route_short_name = route?.route_short_name;
|
|
1454
|
+
}
|
|
1455
|
+
return trip;
|
|
1456
|
+
});
|
|
1457
|
+
return formattedTrips;
|
|
1408
1458
|
};
|
|
1409
1459
|
var getTripsForTimetable = (timetable, calendars, config) => {
|
|
1410
1460
|
const tripQuery = {
|
|
@@ -1430,7 +1480,7 @@ var getTripsForTimetable = (timetable, calendars, config) => {
|
|
|
1430
1480
|
timetable.service_ids = uniq(trips.map((trip) => trip.service_id));
|
|
1431
1481
|
const formattedTrips = [];
|
|
1432
1482
|
for (const trip of trips) {
|
|
1433
|
-
const formattedTrip =
|
|
1483
|
+
const formattedTrip = trip;
|
|
1434
1484
|
formattedTrip.stoptimes = getStoptimes(
|
|
1435
1485
|
{
|
|
1436
1486
|
trip_id: formattedTrip.trip_id
|
|
@@ -1580,7 +1630,7 @@ var formatTimetables = (timetables, config) => {
|
|
|
1580
1630
|
timetable.trip_ids = uniq(
|
|
1581
1631
|
timetable.orderedTrips.map((trip) => trip.trip_id)
|
|
1582
1632
|
);
|
|
1583
|
-
timetable.orderedTrips = filterTrips(timetable, config);
|
|
1633
|
+
timetable.orderedTrips = filterTrips(timetable, calendars, config);
|
|
1584
1634
|
timetable.stops = formatStops(timetable, config);
|
|
1585
1635
|
return timetable;
|
|
1586
1636
|
});
|
|
@@ -2135,22 +2185,6 @@ function formatDaysLong(dayList, config) {
|
|
|
2135
2185
|
const mapObject = zipObject(config.daysShortStrings, config.daysStrings);
|
|
2136
2186
|
return replaceAll(dayList, mapObject);
|
|
2137
2187
|
}
|
|
2138
|
-
function formatTrip(trip, timetable, calendars, config) {
|
|
2139
|
-
trip.calendar = find2(calendars, {
|
|
2140
|
-
service_id: trip.service_id
|
|
2141
|
-
});
|
|
2142
|
-
trip.dayList = formatDays(trip.calendar, config);
|
|
2143
|
-
trip.dayListLong = formatDaysLong(trip.dayList, config);
|
|
2144
|
-
if (timetable.routes.length === 1) {
|
|
2145
|
-
trip.route_short_name = timetable.routes[0].route_short_name;
|
|
2146
|
-
} else {
|
|
2147
|
-
const route = timetable.routes.find(
|
|
2148
|
-
(route2) => route2.route_id === trip.route_id
|
|
2149
|
-
);
|
|
2150
|
-
trip.route_short_name = route.route_short_name;
|
|
2151
|
-
}
|
|
2152
|
-
return trip;
|
|
2153
|
-
}
|
|
2154
2188
|
function formatFrequency(frequency, config) {
|
|
2155
2189
|
const startTime = fromGTFSTime(frequency.start_time);
|
|
2156
2190
|
const endTime = fromGTFSTime(frequency.end_time);
|