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

further unify train line chips #118

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

deingithub
Copy link
Contributor

Currently, the departure board uses the train type as the determining factor for styling. Some private operators like Metronom, erixx, VIAS oder SBB GmbH use a three-letter abbreviation of the company name as the train type and smush the train type and line number into the line data field. This leads to RE lines being displayed in gray instead of orange, for example:
Screenshot 2024-02-15 at 20-08-36 travelynx Unterlüß
Also in the current implementation it is not possible to tell apart two-digit train numbers with long distance trains from the line numbers the HAFAS departure board can display:
Screenshot 2024-02-15 at 20-08-56 travelynx Hannover Hbf
Is that ICE number 72 or some train on ICE line 72?

This patch adds improvements for both of these visual issues.
If a train has a type we don't know about AND the line number starts with a train type we do know about, we can treat that as the actual train type to display:
Screenshot 2024-02-15 at 19-57-57 travelynx Unterlüß
Outside of the departure board, the assumed operator prefix is not hidden and gets added in front of the train number like this:
Screenshot 2024-02-15 at 20-18-22 travelynx

Train lines are now visually distinguished from train numbers. Train numbers are set in semi-bold and roman type. Train lines keep the formatting already applied to them, for long-distance trains that means italic and full bold.
Screenshot 2024-02-15 at 19-57-20 travelynx Leipzig Hbf
Screenshot 2024-02-15 at 19-56-33 travelynx Hannover Hbf

The patch also allows the _format_train template to be used in all contexts and not just for checked-in statuses. It is now uniformly used in all the places that display train numbers that was able to find, including departure board and history entries. It also adds the train types RNV (displayed like STR), Schw-B (like U) and CJX (like RE) to the set of styled train types.

…data sources

private operators sometimes get their an abbreviation as the train type 
and have the actual train type and line number smushed together like 
"SBB S6" or "erx RE10". we can display the train line uniformly.
also support calling _format_train from contexts other than current 
statuses (added hafas and iris departure board as well as history 'mode' 
for the template)
@deingithub
Copy link
Contributor Author

apropos schwebebahn: maybe instead of the very long Schw-B that leads to this big chip with line-wrapping this could be a case where using an emoji substitute can be nice?
Screenshot 2024-02-15 at 20-42-04 travelynx Kluse Wuppertal
vs
Screenshot 2024-02-15 at 20-41-43 travelynx Kluse Wuppertal

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

Successfully merging this pull request may close these issues.

1 participant