[% uri_base = request.uri_base %] [% USE date; USE DataPrinter; # DataPrinter.dump_html(settings); forecast_data = data.forecast.data; # DataPrinter.dump_html(forecast_data); weather_data = data.weather.data; # DataPrinter.dump_html(weather_data); # DataPrinter.dump_html(data.weather.result); # DataPrinter.dump_html(data.forecast.result); %] [% # DataPrinter.dump_html(request.uri) %]

Weather data for [% weather_data.name %] [[% weather_data.sys.country %]] on [% date.format(date.now, '%d-%b-%Y @ %R') %]

Weather for [% '[Leeds]' UNLESS request.uri.match('leeds') %] [% '[Acle]' UNLESS request.uri.match('acle') %]

[% IF weather_data.message %]

ERROR: [% weather_data.message %] [[% params.city.ucfirst %], [% params.country.upper %]]

[% ELSE %]
Summary: [% weather_data.weather.0.description %]
[% DataPrinter.dump_html(weather_data) %]
[% min_temp = weather_data.main.temp_min | format('%.1f'); max_temp = weather_data.main.temp_max | format('%.1f'); avg_temp = weather_data.main.temp | format('%.1f'); %] [% IF weather_data.visibility AND weather_data.visibility < 10000 %] [% END %]
Temperature[% avg_temp %]oC [[% min_temp; ' - '; max_temp %]]
Wind speed [% weather_data.wind.deg | format("%.0f") %]o @ [% weather_data.wind.speed * 2.23694 | format("%.0f") -%] [%- IF weather_data.wind.gust; 'G'; weather_data.wind.gust * 2.23694 | format("%.0f") %] [% END %] mph
Pressure [% weather_data.main.pressure %] hPa
Cloud cover [% weather_data.clouds.all %]%
Visibility [% weather_data.visibility %] mtr
Humidity [% weather_data.main.humidity %]%
Sunrise [% date.format(weather_data.sys.sunrise, '%H:%M') %]Z
Sunset [% date.format(weather_data.sys.sunset, '%H:%M') %]Z
Forecast:
[% FOREACH entry IN forecast_data.list; # DataPrinter.dump_html(entry); weather_icon = entry.weather.0.icon; # eg 01d, 04n, etc; (d)ay, (n)ight %] [% min_temp = entry.main.temp_min | format('%.1f'); max_temp = entry.main.temp_max | format('%.1f'); avg_temp = entry.main.temp | format('%.1f'); class = min_temp < 1 OR entry.main.temp < 1 ? 'cold' : 'normal'; %] [% END %]
Date/Time Summary Temperature Wind speed
[% date.format(entry.dt_txt, '%a %d %b %Y %l%P') .replace('12am','midnight') .replace('12pm','midday') %] [% entry.weather.0.description %] [% IF min_temp != max_temp; min_temp; ' - '; max_temp; ELSE; avg_temp; END -%]oC [% entry.wind.speed * 2.23694 | format("%.0f") -%] [%- IF entry.wind.gust; 'G'; entry.wind.gust * 2.23694 | format("%.0f") %] [% END %] mph
[% END %]