Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to show direction in the title of the route #159

Open
yashgt opened this issue Mar 26, 2024 · 13 comments
Open

Need to show direction in the title of the route #159

yashgt opened this issue Mar 26, 2024 · 13 comments

Comments

@yashgt
Copy link

yashgt commented Mar 26, 2024

I generated the HTML online at Preview . The route name appears twice, one for onward and one for return journey. The name should include a direction. Also, the routes should be listed in a configurable order, such as ordered by name, etc.

@brendannee
Copy link
Member

Can you share with me the GTFS used so I can check it out?

You can configure many aspects of what routes/directions/days get generated and the order by adding https://gtfstohtml.com/docs/timetables and https://gtfstohtml.com/docs/timetable-pages to the GTFS when processing.

@yashgt
Copy link
Author

yashgt commented Mar 27, 2024

Can you share with me the GTFS used so I can check it out?

You can configure many aspects of what routes/directions/days get generated and the order by adding https://gtfstohtml.com/docs/timetables and https://gtfstohtml.com/docs/timetable-pages to the GTFS when processing.

Here is the GTFS file I am using.
GTFS

The timetables.txt lets us individually configure each route. What I am looking for is a way to say that the list of routes will appear sorted by route_name of the route given in routes.txt.

@brendannee
Copy link
Member

Good point.

I tried the GTFS you provided, and noticed that the sorting wasn't working because route_short_name for all routes starts with a non-numeric character.

I updated gtfs-to-html so that timetable pages on the overview page are now sorted be stripping non-numeric characters from route_short_name: eace808 In that commit, you can see where the sorting logic is happening. This isn't included in a published version of GTFS-to-HTML yet, but you can try it out by cloning the repo. Let me know if this handles the sort the way you'd want, or if you think a field in timetable_pages.txt might be useful to manually control sorting.

@yashgt
Copy link
Author

yashgt commented Mar 30, 2024

I suggest the sorting criteria be kept configurable. When generating the html, one can choose short name or route name. Passengers would prefer an html sorted by route name as they may be unfamiliar with the route numbering used at a location they are visiting as tourists.

@brendannee
Copy link
Member

How about a new field in timetable_pages.txt called timetable_page_sequence which would allow you to manually specify the order that timetable pages show up on the summary page? https://gtfstohtml.com/docs/timetable-pages

Let me know what you think of that idea, or if you can see a better way to achieve this.

@brendannee
Copy link
Member

@yashgt Let me know what you think of the idea above - would that work for your use case? Any other ideas?

@yashgt
Copy link
Author

yashgt commented Jan 1, 2025

@brendannee What would be most useful is a top-level option such as "showBothDirectionsTogether" to create a single page for trips of both directions, or an option such as "showDirectionInTitle" to continue showing one page per direction and adding the direction in the title of the page on the landing page.

@brendannee
Copy link
Member

Having a config option to automatically group directions into a single page is a good idea.

@yashgt
Copy link
Author

yashgt commented Jan 11, 2025

I added the timetables.txt and set the timetable_sequence and direction_name fields in it, hoping to see the pages getting listed in a given sequence. However, the pages continue to be listed in only the numeric order. The GTFS is at http://15.206.194.4/gtfs/gtfs.zip . The config jso is attached.
config.json

@brendannee
Copy link
Member

Thanks for pointing that out.

The timetable_sequence field in timetables.txt was meant to control how timetables are sorted on a single timetable page when there are more than one (such as showing multiple directions or days of the week on the same page).

But you are right that there isn't a way to control the order that timetablepages appear on the overview page.

I pushed an update https://github.com/BlinkTagInc/gtfs-to-html/blob/master/views/default/formatting_functions.pug#L148 that moves the sorting logic into the template. In formatting_functions.pug there is a function called sortTimetablePages.

This means you can create a custom template and update this function to sort however you'd like (including using the timetable_sequence of the first timetable of each timetable page).

Check it out and let me know what you think.

@yashgt
Copy link
Author

yashgt commented Jan 12, 2025

ktcl-goa-in: Generating HTML timetables ===================--------------------- 470/1012
Warning: ENOENT: no such file or directory, open 'C:\Users\yashg\AppData\Roaming\npm\node_modules\gtfs-to-html\dist\bin\views\default\timetablepage_full.pug'

I get this error. Apparently the views do not get copid into the dist folder during instalation.

@brendannee
Copy link
Member

Can you let me know the path that gtfs-to-html is set to after install:

which gtfs-to-html

@yashgt
Copy link
Author

yashgt commented Jan 17, 2025

It is under App Roaming folder on Windows. Will give the exact path a bit later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants