gtfs-to-html 2.6.1 → 2.6.2
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/CHANGELOG.md +10 -0
- package/examples/timetable_notes.txt +2 -1
- package/examples/timetable_notes_references.txt +1 -0
- package/lib/file-utils.js +4 -1
- package/lib/utils.js +10 -3
- package/package.json +5 -3
- package/views/default/timetablepage.pug +4 -1
- package/www/docs/additional-files.md +1 -1
- package/www/docs/timetable-notes.md +3 -2
- package/www/package.json +2 -2
- package/www/yarn.lock +482 -496
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.6.2] - 2024-04-19
|
|
9
|
+
|
|
10
|
+
### Updated
|
|
11
|
+
- Dependency updates
|
|
12
|
+
- Update to timetable page sorting
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- Markdown support in timetable notes
|
|
17
|
+
|
|
8
18
|
## [2.6.1] - 2024-03-26
|
|
9
19
|
|
|
10
20
|
### Fixed
|
|
@@ -4,4 +4,5 @@ note_id,symbol,note
|
|
|
4
4
|
3,,"Trip is cancelled if drawbridge is up"
|
|
5
5
|
4,,"This stop is sometimes underwater"
|
|
6
6
|
5,,"Driver will only stop if prearranged by fax"
|
|
7
|
-
6,§,"Vehicle can arrive early if leap second is added during trip"
|
|
7
|
+
6,§,"Vehicle can arrive early if leap second is added during trip and *will not wait*"
|
|
8
|
+
7,,"[See list of holidays](http://transitagency.org/holidays)"
|
package/lib/file-utils.js
CHANGED
|
@@ -11,6 +11,8 @@ import { renderFile } from 'pug';
|
|
|
11
11
|
import puppeteer from 'puppeteer';
|
|
12
12
|
import sanitize from 'sanitize-filename';
|
|
13
13
|
import untildify from 'untildify';
|
|
14
|
+
import insane from 'insane';
|
|
15
|
+
import { marked } from 'marked';
|
|
14
16
|
|
|
15
17
|
import {
|
|
16
18
|
isNullOrEmpty,
|
|
@@ -169,9 +171,10 @@ export function generateFolderName(timetablePage) {
|
|
|
169
171
|
export async function renderTemplate(templateFileName, templateVars, config) {
|
|
170
172
|
const templatePath = getTemplatePath(templateFileName, config);
|
|
171
173
|
|
|
172
|
-
// Make template functions and
|
|
174
|
+
// Make template functions, lodash and marked available inside pug templates.
|
|
173
175
|
const html = await renderFile(templatePath, {
|
|
174
176
|
_,
|
|
177
|
+
md: (text) => insane(marked.parseInline(text)),
|
|
175
178
|
...templateFunctions,
|
|
176
179
|
formatRouteColor,
|
|
177
180
|
formatRouteTextColor,
|
package/lib/utils.js
CHANGED
|
@@ -1612,17 +1612,24 @@ export function generateOverviewHTML(timetablePages, config) {
|
|
|
1612
1612
|
// Sort timetables for display, first numerically then alphabetically.
|
|
1613
1613
|
const sortedTimetablePages = sortBy(timetablePages, [
|
|
1614
1614
|
(timetablePage) => {
|
|
1615
|
+
// First sort numerically by route_short_name, removing leading non-digits
|
|
1615
1616
|
if (
|
|
1616
1617
|
timetablePage.consolidatedTimetables.length > 0 &&
|
|
1617
1618
|
timetablePage.consolidatedTimetables[0].routes.length > 0
|
|
1618
1619
|
) {
|
|
1619
|
-
return
|
|
1620
|
-
|
|
1621
|
-
|
|
1620
|
+
return (
|
|
1621
|
+
Number.parseInt(
|
|
1622
|
+
timetablePage.consolidatedTimetables[0].routes[0].route_short_name?.replace(
|
|
1623
|
+
/^\D+/g,
|
|
1624
|
+
'',
|
|
1625
|
+
),
|
|
1626
|
+
10,
|
|
1627
|
+
) || 0
|
|
1622
1628
|
);
|
|
1623
1629
|
}
|
|
1624
1630
|
},
|
|
1625
1631
|
(timetablePage) => {
|
|
1632
|
+
// Then sort by route_short_name alphabetically
|
|
1626
1633
|
if (
|
|
1627
1634
|
timetablePage.consolidatedTimetables.length > 0 &&
|
|
1628
1635
|
timetablePage.consolidatedTimetables[0].routes.length > 0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gtfs-to-html",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Build human readable transit timetables as HTML, PDF or CSV from GTFS",
|
|
6
6
|
"keywords": [
|
|
@@ -42,14 +42,16 @@
|
|
|
42
42
|
"copy-dir": "^1.3.0",
|
|
43
43
|
"csv-stringify": "^6.4.6",
|
|
44
44
|
"express": "^4.19.2",
|
|
45
|
-
"gtfs": "^4.
|
|
45
|
+
"gtfs": "^4.10.2",
|
|
46
|
+
"insane": "^2.6.2",
|
|
46
47
|
"js-beautify": "^1.15.1",
|
|
47
48
|
"lodash-es": "^4.17.21",
|
|
49
|
+
"marked": "^12.0.2",
|
|
48
50
|
"moment": "^2.30.1",
|
|
49
51
|
"morgan": "^1.10.0",
|
|
50
52
|
"pretty-error": "^4.0.0",
|
|
51
53
|
"pug": "^3.0.2",
|
|
52
|
-
"puppeteer": "^22.6.
|
|
54
|
+
"puppeteer": "^22.6.5",
|
|
53
55
|
"sanitize-filename": "^1.6.3",
|
|
54
56
|
"sqlstring": "^2.3.3",
|
|
55
57
|
"timer-machine": "^1.1.0",
|
|
@@ -54,7 +54,10 @@ include formatting_functions.pug
|
|
|
54
54
|
if timetable.interpolatedStopSymbolUsed
|
|
55
55
|
.note(id=`note-${timetable.timetable_id}-interpolated-stop`)= `${config.interpolatedStopSymbol} = ${config.interpolatedStopText}`
|
|
56
56
|
each note in _.uniqBy(timetable.notes, 'note_id')
|
|
57
|
-
.note(id=`note-${timetable.timetable_id}-${note.note_id}`)
|
|
57
|
+
.note(id=`note-${timetable.timetable_id}-${note.note_id}`)
|
|
58
|
+
span= note.symbol
|
|
59
|
+
span =
|
|
60
|
+
span!= md(note.note)
|
|
58
61
|
|
|
59
62
|
if config.showCalendarExceptions && timetable.calendarDates.includedDates.length
|
|
60
63
|
.included-dates= `${config.serviceProvidedOnText}: ${timetable.calendarDates.includedDates.join(', ')}`
|
|
@@ -13,7 +13,7 @@ By default, GTFS-to-HTML attempts to generate a timetable for each route and dir
|
|
|
13
13
|
* [timetable_pages.txt](/docs/timetable-pages) - Specifies which HTML timetables should be grouped together into a single HTML page.
|
|
14
14
|
|
|
15
15
|
## Adding notes to timetables
|
|
16
|
-
Notes about a specific trip, stop, stoptime, route or timetable can be added to timetables by using `timetable_notes.txt` and `timetable_notes_references.txt` in your GTFS.
|
|
16
|
+
Notes about a specific trip, stop, stoptime, route or timetable can be added to timetables by using `timetable_notes.txt` and `timetable_notes_references.txt` in your GTFS. These notes can include links and other formatting using Markdown syntax.
|
|
17
17
|
|
|
18
18
|
* [timetable_notes.txt](/docs/timetable-notes) - Specifies notes to be used in timetables.
|
|
19
19
|
* [timetable_notes_references.txt](/docs/timetable-notes-references) - Specifies where notes should be placed in timetables.
|
|
@@ -15,7 +15,7 @@ Notes can have a `symbol` specified or can be left blank and GTFS-to-HTML will a
|
|
|
15
15
|
| ----------- | ----------- |
|
|
16
16
|
| `note_id` | A unique ID for the timetable note |
|
|
17
17
|
| `symbol` | The symbol used to indicate the note, such as `§`. Optional, if omitted a letter of the alphabet starting with `a` will be used. |
|
|
18
|
-
| `note` | The text of the note, such as "This stop is sometimes underwater". |
|
|
18
|
+
| `note` | The text of the note, such as "This stop is sometimes underwater". [Markdown syntax](https://daringfireball.net/projects/markdown/syntax) is supported which allows including links and formatting. |
|
|
19
19
|
|
|
20
20
|
### Example
|
|
21
21
|
|
|
@@ -26,7 +26,8 @@ note_id,symbol,note
|
|
|
26
26
|
3,,"Trip is cancelled if drawbridge is up"
|
|
27
27
|
4,,"This stop is sometimes underwater"
|
|
28
28
|
5,,"Driver will only stop if prearranged by fax"
|
|
29
|
-
6,§,"Vehicle can arrive early if leap second is added during trip"
|
|
29
|
+
6,§,"Vehicle can arrive early if leap second is added during trip and *will not wait*"
|
|
30
|
+
7,,"[See list of holidays](http://transitagency.org/holidays)"
|
|
30
31
|
```
|
|
31
32
|
|
|
32
33
|
An example of this file is located in [examples/timetable_notes.txt](https://github.com/BlinkTagInc/gtfs-to-html/blob/master/examples/timetable_notes.txt).
|
package/www/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"deploy": "docusaurus deploy"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@docusaurus/core": "^3.
|
|
13
|
-
"@docusaurus/preset-classic": "^3.
|
|
12
|
+
"@docusaurus/core": "^3.2.1",
|
|
13
|
+
"@docusaurus/preset-classic": "^3.2.1",
|
|
14
14
|
"clsx": "^2.1.0",
|
|
15
15
|
"react": "^18.2.0",
|
|
16
16
|
"react-dom": "^18.2.0"
|