From a36801c967c790ed10d7d074af12f9832a42aa50 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Mon, 20 Nov 2023 17:17:13 +0100 Subject: perltidy --- lib/DBInfoscreen.pm | 8 +- lib/DBInfoscreen/Controller/Wagenreihung.pm | 8 +- lib/DBInfoscreen/Helper/EFA.pm | 6 +- lib/DBInfoscreen/Helper/HAFAS.pm | 28 +++---- lib/DBInfoscreen/I18N/en.pm | 120 +++++++++++++++------------- 5 files changed, 89 insertions(+), 81 deletions(-) (limited to 'lib') diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm index 9d67f77..c8960c9 100644 --- a/lib/DBInfoscreen.pm +++ b/lib/DBInfoscreen.pm @@ -53,10 +53,10 @@ sub startup { before_dispatch => sub { my ($self) = @_; - # The "theme" cookie is set client-side if the theme we delivered was - # changed by dark mode detection or by using the theme switcher. It's - # not part of Mojolicious' session data (and can't be, due to - # signing and HTTPOnly), so we need to add it here. + # The "theme" cookie is set client-side if the theme we delivered was + # changed by dark mode detection or by using the theme switcher. It's + # not part of Mojolicious' session data (and can't be, due to + # signing and HTTPOnly), so we need to add it here. for my $cookie ( @{ $self->req->cookies } ) { if ( $cookie->name eq 'theme' ) { diff --git a/lib/DBInfoscreen/Controller/Wagenreihung.pm b/lib/DBInfoscreen/Controller/Wagenreihung.pm index 3287d85..c821e11 100644 --- a/lib/DBInfoscreen/Controller/Wagenreihung.pm +++ b/lib/DBInfoscreen/Controller/Wagenreihung.pm @@ -226,10 +226,10 @@ sub wagenreihung { and $wnb2 =~ m{^\d+$} ) { - # We need to perform normalization in two cases: - # * wagon 1 is leftmost and its number is higher than wagon 2 - # * wagon 1 is rightmost and its number is lower than wagon 2 - # (-> the leftmost wagon has the highest number) + # We need to perform normalization in two cases: + # * wagon 1 is leftmost and its number is higher than wagon 2 + # * wagon 1 is rightmost and its number is lower than wagon 2 + # (-> the leftmost wagon has the highest number) # However, if wpa/wna und wpb/wnb do not match, we have a # winged train with different normalization requirements diff --git a/lib/DBInfoscreen/Helper/EFA.pm b/lib/DBInfoscreen/Helper/EFA.pm index 41035d4..2a7416e 100644 --- a/lib/DBInfoscreen/Helper/EFA.pm +++ b/lib/DBInfoscreen/Helper/EFA.pm @@ -49,8 +49,7 @@ sub get_json_p { if ( my $err = $tx->error ) { $self->{log}->debug( -"efa->get_json_p($url): HTTP $err->{code} $err->{message}" - ); + "efa->get_json_p($url): HTTP $err->{code} $err->{message}"); $cache->freeze( $url, { error => $err->{message} } ); $promise->reject( "GET $url returned HTTP $err->{code} $err->{message}"); @@ -60,8 +59,7 @@ sub get_json_p { my $res = $tx->res->json; if ( not $res ) { - $self->{log} - ->debug("efa->get_json_p($url): empty response"); + $self->{log}->debug("efa->get_json_p($url): empty response"); $promise->reject("GET $url returned empty response"); return; } diff --git a/lib/DBInfoscreen/Helper/HAFAS.pm b/lib/DBInfoscreen/Helper/HAFAS.pm index 66a43df..e5c82e7 100644 --- a/lib/DBInfoscreen/Helper/HAFAS.pm +++ b/lib/DBInfoscreen/Helper/HAFAS.pm @@ -115,19 +115,19 @@ sub trainsearch_p { # Try finding a result for the current date for my $suggestion ( @{ $trainsearch->{suggestions} // [] } ) { - # Drunken API, sail with care. Both date formats are used interchangeably + # Drunken API, sail with care. Both date formats are used interchangeably if ( exists $suggestion->{depDate} and ( $suggestion->{depDate} eq $opt{date_yy} or $suggestion->{depDate} eq $opt{date_yyyy} ) ) { - # Train numbers are not unique, e.g. IC 149 refers both to the - # InterCity service Amsterdam -> Berlin and to the InterCity service - # Koebenhavns Lufthavn st -> Aarhus. One workaround is making - # requests with the stationFilter=80 parameter. Checking the origin - # station seems to be the more generic solution, so we do that - # instead. + # Train numbers are not unique, e.g. IC 149 refers both to the + # InterCity service Amsterdam -> Berlin and to the InterCity service + # Koebenhavns Lufthavn st -> Aarhus. One workaround is making + # requests with the stationFilter=80 parameter. Checking the origin + # station seems to be the more generic solution, so we do that + # instead. if ( $opt{train_origin} and $suggestion->{dep} eq $opt{train_origin} ) { @@ -139,10 +139,10 @@ sub trainsearch_p { if ($result) { - # The trip_id's date part doesn't seem to matter -- so far, HAFAS is - # happy as long as the date part starts with a number. HAFAS-internal - # tripIDs use this format (withouth leading zero for day of month < 10) - # though, so let's stick with it. + # The trip_id's date part doesn't seem to matter -- so far, HAFAS is + # happy as long as the date part starts with a number. HAFAS-internal + # tripIDs use this format (withouth leading zero for day of month < 10) + # though, so let's stick with it. my $date_map = $opt{date_yyyy}; $date_map =~ tr{.}{}d; $result->{trip_id} = sprintf( '1|%d|%d|%d|%s', @@ -156,9 +156,9 @@ sub trainsearch_p { $promise->reject("Zug $opt{train_req} nicht gefunden"); } - # do not propagate $promise->reject's return value to this promise. - # Perl implicitly returns the last statement, so we explicitly return - # nothing to avoid this. + # do not propagate $promise->reject's return value to this promise. + # Perl implicitly returns the last statement, so we explicitly return + # nothing to avoid this. return; } )->catch( diff --git a/lib/DBInfoscreen/I18N/en.pm b/lib/DBInfoscreen/I18N/en.pm index 20c4440..50790c5 100644 --- a/lib/DBInfoscreen/I18N/en.pm +++ b/lib/DBInfoscreen/I18N/en.pm @@ -7,68 +7,78 @@ package DBInfoscreen::I18N::en; use Mojo::Base 'DBInfoscreen::I18N'; our %Lexicon = ( -# common + + # common 'Stationen in der Umgebung suchen' => 'Find stops nearby', -# layouts/app - 'Mehrdeutige Eingabe' => 'Ambiguous input', - 'Bitte eine Station aus der Liste auswählen' => 'Please select a station from the list', + + # layouts/app + 'Mehrdeutige Eingabe' => 'Ambiguous input', + 'Bitte eine Station aus der Liste auswählen' => + 'Please select a station from the list', 'Zug / Station' => 'Enter train number or station name', - 'Zug, Stationsname oder Ril100-Kürzel' => 'train, station name, or DS100 code', - 'Abfahrstafel' => 'Show departures', - 'Weitere Einstellungen'=> 'Preferences', - 'Zeiten inkl. Verspätung angeben' => 'Include delay in timestamps', + 'Zug, Stationsname oder Ril100-Kürzel' => + 'train, station name, or DS100 code', + 'Abfahrstafel' => 'Show departures', + 'Weitere Einstellungen' => 'Preferences', + 'Zeiten inkl. Verspätung angeben' => 'Include delay in timestamps', 'Verspätungen erst ab 5 Minuten anzeigen' => 'Hide delays below 5 minutes', - 'Mehr Details' => 'Verbose mode', - 'Betriebliche Bahnhofstrennungen berücksichtigen (z.B. "Hbf (Fern+Regio)" vs. "Hbf (S)")' => 'Respect split stations; do not join them', - 'Bereits abgefahrene Züge anzeigen' => 'Include past trains', - 'Formular verstecken' => 'Hide form', - 'Nur Züge über' => 'Only show trains via', - 'Bahnhof 1, Bhf2, ... (oder regulärer Ausdruck)' => 'Station 1, 2, ... (or regular expression)', - 'Gleise' => 'Platforms', + 'Mehr Details' => 'Verbose mode', +'Betriebliche Bahnhofstrennungen berücksichtigen (z.B. "Hbf (Fern+Regio)" vs. "Hbf (S)")' + => 'Respect split stations; do not join them', + 'Bereits abgefahrene Züge anzeigen' => 'Include past trains', + 'Formular verstecken' => 'Hide form', + 'Nur Züge über' => 'Only show trains via', + 'Bahnhof 1, Bhf2, ... (oder regulärer Ausdruck)' => + 'Station 1, 2, ... (or regular expression)', + 'Gleise' => 'Platforms', 'Ankunfts- oder Abfahrtszeit anzeigen?' => 'Show arrival or departure?', - 'Abfahrt bevorzugen' => 'prefer departure', - 'Nur Abfahrt' => 'departure only', - 'Nur Ankunft' => 'arrival only', - 'Anzeigen' => 'Submit', - 'Über DBF' => 'About', - 'Datenschutz' => 'Privacy', - 'Impressum' => 'Imprint', -# landing page + 'Abfahrt bevorzugen' => 'prefer departure', + 'Nur Abfahrt' => 'departure only', + 'Nur Ankunft' => 'arrival only', + 'Anzeigen' => 'Submit', + 'Über DBF' => 'About', + 'Datenschutz' => 'Privacy', + 'Impressum' => 'Imprint', + + # landing page 'Oder hier angeben:' => 'Or enter manually:', -# train details - 'Gleis' => 'Platform', - 'An:' => 'Arr', - 'Ab:' => 'Dep', - 'Plan:' => 'Sched', - 'Auslastung unbekannt' => 'Occupancy unknown', - 'Geringe Auslastung' => 'Low occupancy', - 'Hohe Auslastung' => 'High occupancy', - 'Sehr hohe Auslastung' => 'Very high occupancy', - 'Zug ist ausgebucht' => 'Fully booked', - 'Geringe Auslastung erwartet' => 'Low occupancy expected', - 'Hohe Auslastung erwartet' => 'High occupancy expected', + + # train details + 'Gleis' => 'Platform', + 'An:' => 'Arr', + 'Ab:' => 'Dep', + 'Plan:' => 'Sched', + 'Auslastung unbekannt' => 'Occupancy unknown', + 'Geringe Auslastung' => 'Low occupancy', + 'Hohe Auslastung' => 'High occupancy', + 'Sehr hohe Auslastung' => 'Very high occupancy', + 'Zug ist ausgebucht' => 'Fully booked', + 'Geringe Auslastung erwartet' => 'Low occupancy expected', + 'Hohe Auslastung erwartet' => 'High occupancy expected', 'Sehr hohe Auslastung erwartet' => 'Very high occupancy expected', - 'Meldungen' => 'Messages', - 'Fahrtverlauf' => 'Route', - 'Betrieb' => 'Operator', - 'Karte' => 'Map', - 'Wagen' => 'Composition', -# wagon order - 'Nach' => 'To', + 'Meldungen' => 'Messages', + 'Fahrtverlauf' => 'Route', + 'Betrieb' => 'Operator', + 'Karte' => 'Map', + 'Wagen' => 'Composition', + + # wagon order + 'Nach' => 'To', 'in Abschnitt' => 'in sections', - 'Wagen ' => 'carriage ', -# map - 'Fahrt' => 'Trip', - 'von' => 'from', - 'nach' => 'to', - 'Nächster Halt:' => 'Next stop:', - 'um' => 'at', - 'auf Gleis' => 'on platform', - 'Aufenthalt in' => 'Stopped in', - 'an Gleis' => 'on platform', - 'bis' => 'until', - 'Abfahrt in' => 'Departs', - 'von Gleis' => 'from platform', + 'Wagen ' => 'carriage ', + + # map + 'Fahrt' => 'Trip', + 'von' => 'from', + 'nach' => 'to', + 'Nächster Halt:' => 'Next stop:', + 'um' => 'at', + 'auf Gleis' => 'on platform', + 'Aufenthalt in' => 'Stopped in', + 'an Gleis' => 'on platform', + 'bis' => 'until', + 'Abfahrt in' => 'Departs', + 'von Gleis' => 'from platform', 'Endstation erreicht um' => 'Terminus reached at', ); -- cgit v1.2.3