Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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:
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:
Outside of the departure board, the assumed operator prefix is not hidden and gets added in front of the train number like this:
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.
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.