gtfs-to-html 2.9.1 → 2.9.3
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/config-sample.json +68 -0
- package/dist/app/index.js +26 -18
- package/dist/app/index.js.map +1 -1
- package/dist/bin/gtfs-to-html.js +40 -33
- package/dist/bin/gtfs-to-html.js.map +1 -1
- package/dist/index.js +39 -32
- package/dist/index.js.map +1 -1
- package/docker/Dockerfile +14 -0
- package/docker/README.md +5 -0
- package/docker/config.json +21 -0
- package/docker/docker-compose.yml +10 -0
- package/examples/stop_attributes.txt +6 -0
- package/examples/timetable_notes.txt +8 -0
- package/examples/timetable_notes_references.txt +8 -0
- package/examples/timetable_pages.txt +3 -0
- package/examples/timetable_stop_order.txt +16 -0
- package/examples/timetables.txt +9 -0
- package/package.json +7 -3
- package/views/default/css/overview_styles.css +198 -0
- package/views/default/css/timetable_pdf_styles.css +69 -0
- package/views/default/css/timetable_styles.css +522 -0
- package/views/default/formatting_functions.pug +104 -0
- package/views/default/js/system-map.js +594 -0
- package/views/default/js/timetable-map.js +753 -0
- package/views/default/js/timetable-menu.js +57 -0
- package/views/default/layout.pug +11 -0
- package/views/default/overview.pug +27 -0
- package/views/default/overview_full.pug +16 -0
- package/views/default/timetable_continuation_as.pug +7 -0
- package/views/default/timetable_continuation_from.pug +7 -0
- package/views/default/timetable_horizontal.pug +42 -0
- package/views/default/timetable_hourly.pug +30 -0
- package/views/default/timetable_map.pug +15 -0
- package/views/default/timetable_menu.pug +48 -0
- package/views/default/timetable_note_symbol.pug +5 -0
- package/views/default/timetable_stop_name.pug +13 -0
- package/views/default/timetable_stoptime.pug +17 -0
- package/views/default/timetable_vertical.pug +67 -0
- package/views/default/timetablepage.pug +65 -0
- package/views/default/timetablepage_full.pug +25 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"agencies": [
|
|
3
|
+
{
|
|
4
|
+
"agencyKey": "marintransit",
|
|
5
|
+
"url": "https://marintransit.org/data/google_transit.zip",
|
|
6
|
+
"realtimeAlerts": {
|
|
7
|
+
"url": "https://api.marintransit.org/alerts"
|
|
8
|
+
},
|
|
9
|
+
"realtimeTripUpdates": {
|
|
10
|
+
"url": "https://api.marintransit.org/tripupdates"
|
|
11
|
+
},
|
|
12
|
+
"realtimeVehiclePositions": {
|
|
13
|
+
"url": "https://api.marintransit.org/vehiclepositions"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"sqlitePath": "/tmp/gtfs",
|
|
18
|
+
"allowEmptyTimetables": false,
|
|
19
|
+
"beautify": false,
|
|
20
|
+
"coordinatePrecision": 5,
|
|
21
|
+
"dateFormat": "MMM D, YYYY",
|
|
22
|
+
"daysShortStrings": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
|
|
23
|
+
"daysStrings": [
|
|
24
|
+
"Monday",
|
|
25
|
+
"Tuesday",
|
|
26
|
+
"Wednesday",
|
|
27
|
+
"Thursday",
|
|
28
|
+
"Friday",
|
|
29
|
+
"Saturday",
|
|
30
|
+
"Sunday"
|
|
31
|
+
],
|
|
32
|
+
"defaultOrientation": "vertical",
|
|
33
|
+
"effectiveDate": "July 8, 2016",
|
|
34
|
+
"interpolatedStopSymbol": "•",
|
|
35
|
+
"interpolatedStopText": "Estimated time of arrival",
|
|
36
|
+
"linkStopUrls": false,
|
|
37
|
+
"mapboxAccessToken": "YOUR MAPBOX ACCESS TOKEN",
|
|
38
|
+
"menuType": "jump",
|
|
39
|
+
"noDropoffSymbol": "‡",
|
|
40
|
+
"noDropoffText": "No drop off available",
|
|
41
|
+
"noHead": false,
|
|
42
|
+
"noPickupSymbol": "**",
|
|
43
|
+
"noPickupText": "No pickup available",
|
|
44
|
+
"noServiceSymbol": "—",
|
|
45
|
+
"noServiceText": "No service at this stop",
|
|
46
|
+
"outputFormat": "html",
|
|
47
|
+
"requestDropoffSymbol": "†",
|
|
48
|
+
"requestDropoffText": "Must request drop off",
|
|
49
|
+
"requestPickupSymbol": "***",
|
|
50
|
+
"requestPickupText": "Request stop - call for pickup",
|
|
51
|
+
"serviceNotProvidedOnText": "Service not provided on",
|
|
52
|
+
"serviceProvidedOnText": "Service provided on",
|
|
53
|
+
"showArrivalOnDifference": 0.2,
|
|
54
|
+
"showCalendarExceptions": true,
|
|
55
|
+
"showMap": true,
|
|
56
|
+
"showOnlyTimepoint": true,
|
|
57
|
+
"showRouteTitle": true,
|
|
58
|
+
"showStopCity": false,
|
|
59
|
+
"showStopDescription": false,
|
|
60
|
+
"showStoptimesForRequestStops": true,
|
|
61
|
+
"skipImport": false,
|
|
62
|
+
"sortingAlgorithm": "common",
|
|
63
|
+
"templatePath": "views/default",
|
|
64
|
+
"timeFormat": "h:mma",
|
|
65
|
+
"useParentStation": true,
|
|
66
|
+
"verbose": true,
|
|
67
|
+
"zipOutput": false
|
|
68
|
+
}
|
package/dist/app/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var __export = (target, all) => {
|
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
// src/app/index.ts
|
|
8
|
-
import
|
|
8
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
9
9
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
10
10
|
import { readFileSync } from "node:fs";
|
|
11
11
|
import { map } from "lodash-es";
|
|
@@ -131,7 +131,7 @@ import sqlString from "sqlstring";
|
|
|
131
131
|
import toposort from "toposort";
|
|
132
132
|
|
|
133
133
|
// src/lib/file-utils.ts
|
|
134
|
-
import
|
|
134
|
+
import { dirname, join, resolve } from "node:path";
|
|
135
135
|
import { fileURLToPath } from "node:url";
|
|
136
136
|
import _ from "lodash-es";
|
|
137
137
|
import archiver from "archiver";
|
|
@@ -258,13 +258,24 @@ function formatTripNameForCSV(trip, timetable) {
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
// src/lib/file-utils.ts
|
|
261
|
-
function
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
261
|
+
function getPathToViewsFolder(config2) {
|
|
262
|
+
if (config2.templatePath) {
|
|
263
|
+
return untildify(config2.templatePath);
|
|
264
|
+
}
|
|
265
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
266
|
+
let viewsFolderPath;
|
|
267
|
+
if (__dirname.endsWith("/dist/bin") || __dirname.endsWith("/dist/app")) {
|
|
268
|
+
viewsFolderPath = resolve(__dirname, "../../views/default");
|
|
269
|
+
} else if (__dirname.endsWith("/dist")) {
|
|
270
|
+
viewsFolderPath = resolve(__dirname, "../views/default");
|
|
271
|
+
} else {
|
|
272
|
+
viewsFolderPath = resolve(__dirname, "views/default");
|
|
265
273
|
}
|
|
266
|
-
|
|
267
|
-
|
|
274
|
+
return viewsFolderPath;
|
|
275
|
+
}
|
|
276
|
+
function getPathToTemplateFile(templateFileName, config2) {
|
|
277
|
+
const fullTemplateFileName = config2.noHead !== true ? `${templateFileName}_full.pug` : `${templateFileName}.pug`;
|
|
278
|
+
return join(getPathToViewsFolder(config2), fullTemplateFileName);
|
|
268
279
|
}
|
|
269
280
|
function generateFileName(timetable, config2, extension = "html") {
|
|
270
281
|
let filename = timetable.timetable_id;
|
|
@@ -278,7 +289,7 @@ function generateFileName(timetable, config2, extension = "html") {
|
|
|
278
289
|
return sanitize(filename).toLowerCase();
|
|
279
290
|
}
|
|
280
291
|
async function renderTemplate(templateFileName, templateVars, config2) {
|
|
281
|
-
const templatePath =
|
|
292
|
+
const templatePath = getPathToTemplateFile(templateFileName, config2);
|
|
282
293
|
const html = await renderFile(templatePath, {
|
|
283
294
|
_,
|
|
284
295
|
md: (text) => insane(marked.parseInline(text)),
|
|
@@ -365,7 +376,7 @@ function getAgencyGeoJSON(config2) {
|
|
|
365
376
|
}
|
|
366
377
|
|
|
367
378
|
// package.json
|
|
368
|
-
var version = "2.9.
|
|
379
|
+
var version = "2.9.2";
|
|
369
380
|
|
|
370
381
|
// src/lib/utils.ts
|
|
371
382
|
var isTimepoint = (stoptime) => {
|
|
@@ -1772,7 +1783,7 @@ var argv = yargs(hideBin(process.argv)).option("c", {
|
|
|
1772
1783
|
}).parseSync();
|
|
1773
1784
|
var app = express();
|
|
1774
1785
|
var router = express.Router();
|
|
1775
|
-
var configPath = argv.configPath ||
|
|
1786
|
+
var configPath = argv.configPath || join2(process.cwd(), "config.json");
|
|
1776
1787
|
var selectedConfig = JSON.parse(readFileSync(configPath, "utf8"));
|
|
1777
1788
|
var config = setDefaultConfig(selectedConfig);
|
|
1778
1789
|
config.noHead = false;
|
|
@@ -1836,24 +1847,21 @@ router.get("/timetables/:timetablePageId", async (request, response, next) => {
|
|
|
1836
1847
|
next(error);
|
|
1837
1848
|
}
|
|
1838
1849
|
});
|
|
1839
|
-
app.set("views",
|
|
1850
|
+
app.set("views", getPathToViewsFolder(config));
|
|
1840
1851
|
app.set("view engine", "pug");
|
|
1841
1852
|
app.use(logger("dev"));
|
|
1842
|
-
var staticAssetPath = config.templatePath === void 0 ?
|
|
1853
|
+
var staticAssetPath = config.templatePath === void 0 ? getPathToViewsFolder(config) : untildify2(config.templatePath);
|
|
1843
1854
|
app.use(express.static(staticAssetPath));
|
|
1844
1855
|
app.use(
|
|
1845
1856
|
"/js",
|
|
1846
1857
|
express.static(
|
|
1847
|
-
|
|
1858
|
+
join2(dirname2(fileURLToPath2(import.meta.resolve("pbf"))), "dist")
|
|
1848
1859
|
)
|
|
1849
1860
|
);
|
|
1850
1861
|
app.use(
|
|
1851
1862
|
"/js",
|
|
1852
1863
|
express.static(
|
|
1853
|
-
|
|
1854
|
-
fileURLToPath2(import.meta.url),
|
|
1855
|
-
"../../../node_modules/gtfs-realtime-pbf-js-module"
|
|
1856
|
-
)
|
|
1864
|
+
dirname2(fileURLToPath2(import.meta.resolve("gtfs-realtime-pbf-js-module")))
|
|
1857
1865
|
)
|
|
1858
1866
|
);
|
|
1859
1867
|
app.use("/", router);
|