% if (@{$departures}) {

% if (param('dark')) {
<div class="infoscreen infoscreendark">
% }
% else {
<div class="infoscreen infoscreenlight">
% }
<ul>
% my $i = 0;
% my $dt_now = DateTime->now;
% for my $departure (@{$departures}) {
%   $i++;
%   my $route_str = q{};
%   my $via_max = @{$departure->{via} // []};
%   my $via_cur = 0;
%   for my $stop (@{$departure->{via} // []}) {
%     $via_cur++;
%     $route_str .= $stop . ($via_cur < $via_max ? ' - ' : q{});
%   }
%   my $extraclasses = q{};
%   if ($departure->{is_cancelled} or $departure->{departure_is_cancelled}) {
%     $extraclasses .= ' cancelled';
      <li class="cancelled">
%   }
%   else {
      <li>
%   }
%   my $linetype = 'bahn';
%   if ( $departure->{train_type} eq 'S' ) {
%     $linetype = 'sbahn';
%   }
%   elsif ( $departure->{train_type} eq 'IC'
%          or $departure->{train_type} eq 'ICE'
%          or $departure->{train_type} eq 'EC'
%          or $departure->{train_type} eq 'ECE'
%          or $departure->{train_type} eq 'EN') {
%     $linetype = 'fern';
%   }
%   elsif ( $departure->{train_type} eq 'THA'
%          or $departure->{train_type} eq 'TGV'
%          or $departure->{train_type} eq 'FLX'
%          or $departure->{train_type} eq 'NJ') {
%     $linetype = 'ext';
%   }
%   elsif ( $departure->{train_line} and $departure->{train_line} =~ m{^S\d} ) {
%     $linetype = 'sbahn';
%   }
    <div class="line <%= $linetype %>">
    % if ($departure->{train_type} and $departure->{train_no}) {
%=    $departure->{train_type}
%   }
%   if ($departure->{train_line} ) {
%=    $departure->{train_line}
%   }
%   elsif ($departure->{train_no}) {
      <span class="trainno"><%= $departure->{train_no} %></span>
%   }
%   else {
%=    $departure->{train}
%   }
%   if ($departure->{train_line} and $departure->{train_no}
%       and $departure->{train_line} ne $departure->{train_no}
%       and param('detailed')) {
      <div class="trainno_sub"><%= $departure->{train_no} %></div>
%   }
    </div>
%   if (@{$departure->{replaced_by}} or @{$departure->{replacement_for}}) {
      <div class="lineinfo">
%     if (@{$departure->{replaced_by}}) {
        %#<span class="replaced">→ Ersatzzug</span>
%     }
%     if (@{$departure->{replacement_for}}) {
        <span class="replacement">Ersatzzug</span>
%     }
      </div>
%   }
%   if ($departure->{info} and length $departure->{info}) {
      <span class="info">
%=    $departure->{info}
      </span>
%   }
%   else {
      <span class="route">
%=    $route_str
      </span>
%   }
    <span class="dest <%= $extraclasses %>">
%=  $departure->{destination}
    </span>
    <span class="countdown <%= $extraclasses %>">
%   if ($departure->{delay} and not $departure->{is_cancelled}) {
%     if ($show_realtime) {
%       if ($departure->{delay} > 0) {
          <span class="delaynorm">(+<%= $departure->{delay} %>)</span>
%       }
%       else {
          <span class="undelaynorm">(<%= $departure->{delay} %>)</span>
%       }
%     }
%     else {
%       if ($departure->{delay} > 0) {
          <span class="delay">(+<%= $departure->{delay} %>)</span>
%       }
%       else {
          <span class="undelay">(<%= $departure->{delay} %>)</span>
%       }
%     }
%   }
%   if (($departure->{scheduled_platform} and $departure->{platform} and
%       $departure->{scheduled_platform} ne $departure->{platform})
%       or $departure->{changed_platform}) {
      <span class="platform changed-platform">
%   }
%   else {
      <span class="platform">
%   }
%=  $departure->{platform}
    </span>
    </span>
    <span class="time <%= ($show_realtime and $departure->{delay} and not
      $departure->{is_cancelled}) ? 'delayed' : q{} %> <%= $extraclasses %>">
%   if (param('detailed')) {
%     my $arrow = '→';
%     if (not $departure->{sched_arrival}) {
%       $arrow = '↦';
%     }
%     elsif (not $departure->{sched_departure}) {
%       $arrow = '⇥';
%     }
%     if ($show_realtime) {
%=      ($departure->{arrival} // q{}) . $arrow . ($departure->{departure} // q{})
%     }
%     else {
%=      ($departure->{sched_arrival} // q{}) . $arrow . ($departure->{sched_departure} // q{})
%     }
%   }
%   else {
%=    $departure->{time}
%   }
    </span>
    </li>

% }

  </ul>
  </div> <!-- infoscreen -->

% }
% else {

<div class="container">
<div class="error"><strong>Keine Abfahrten gefunden.</strong>
Möglicherweise ist der Filter zu restriktiv, oder an dieser Station fahren
momentan keine Züge.</div>
</div> <!-- container -->

% }