diff options
| author | Bnyro <bnyro@tutanota.com> | 2025-04-24 17:28:16 +0200 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarIT.de> | 2025-05-31 20:34:59 +0200 |
| commit | d70f0a3321b32816c0f277b4be9a43e4f1074b39 (patch) | |
| tree | 9b59c2058e41296a3cffa4c70cf1611e185e8145 /searx/templates/simple | |
| parent | 37d851fb23935166ac7714a83c7273ce712bece0 (diff) | |
[feat] result types: add weather result answerer and template
Diffstat (limited to 'searx/templates/simple')
| -rw-r--r-- | searx/templates/simple/answer/weather.html | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/searx/templates/simple/answer/weather.html b/searx/templates/simple/answer/weather.html new file mode 100644 index 000000000..4cea9b683 --- /dev/null +++ b/searx/templates/simple/answer/weather.html @@ -0,0 +1,67 @@ +{% macro show_weather_data(data) %} + <table> + <tbody> + {%- if data.condition -%} + <tr> + <td>{{ _("Condition") }}</td> + <td>{{ data.condition }}</td> + </tr> + {%- endif -%} + {%- if data.temperature -%} + <tr> + <td>{{ _("Temperature") }}</td> + <td>{{ data.temperature }}</td> + </tr> + {%- endif -%} + {%- if data.feelsLike -%} + <tr> + <td>{{ _("Feels Like") }}</td> + <td>{{ data.feelsLike }}</td> + </tr> + {%- endif -%} + {%- if data.wind -%} + <tr> + <td>{{ _("Wind") }}</td> + <td>{{ data.wind }}</td> + </tr> + {%- endif -%} + {%- if data.humidity -%} + <tr> + <td>{{ _("Humidity") }}</td> + <td>{{ data.humidity }}</td> + </tr> + {%- endif -%} + {%- if data.pressure -%} + <tr> + <td>{{ _("Pressure") }}</td> + <td>{{ data.pressure }}</td> + </tr> + {%- endif -%} + <tr> + {%- for name, value in data.attributes.items() -%} + <tr> + <td>{{ name }}</td> + <td>{{ value }}</td> + </tr> + {%- endfor -%} + </tbody> + </table> +{% endmacro %} + +<details class="answer-weather"> + <summary>It's currently {{ answer.current.condition }}, {{ answer.current.temperature }} in {{ answer.location }}</summary> + <div> + <h2 class="title">{{ answer.location }}</h2> + <h3>{{ _("Current condition") }}</h3> + {{ show_weather_data(answer.current) }} + + {%- if answer.forecasts -%} + <div class="answer-weather-forecasts"> + {%- for forecast in answer.forecasts -%} + <h3>{{ forecast.time }}</h3> + {{ show_weather_data(forecast) }} + {%- endfor -%} + </div> + {%- endif -%} + </div> +</details> |