summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--searx/engines/openstreetmap.py83
-rw-r--r--searx/static/themes/simple/less/style.less3
-rw-r--r--searx/templates/oscar/result_templates/map.html2
3 files changed, 38 insertions, 50 deletions
diff --git a/searx/engines/openstreetmap.py b/searx/engines/openstreetmap.py
index 819a2ea1d..6920356c3 100644
--- a/searx/engines/openstreetmap.py
+++ b/searx/engines/openstreetmap.py
@@ -1,8 +1,8 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
-"""
- OpenStreetMap (Map)
-"""
# lint: pylint
+"""OpenStreetMap (Map)
+
+"""
# pylint: disable=missing-function-docstring
import re
@@ -151,16 +151,13 @@ def response(resp):
user_language = resp.search_params['language']
if resp.search_params['route']:
- results.append(
- {
- 'answer': gettext('Get directions'),
- 'url': route_url.format(*resp.search_params['route'].groups()),
- }
- )
+ results.append({
+ 'answer': gettext('Get directions'),
+ 'url': route_url.format(*resp.search_params['route'].groups()),
+ })
fetch_wikidata(nominatim_json, user_language)
- # parse results
for result in nominatim_json:
title, address = get_title_address(result)
@@ -173,29 +170,27 @@ def response(resp):
links, link_keys = get_links(result, user_language)
data = get_data(result, user_language, link_keys)
- # append result
- results.append(
- {
- 'template': 'map.html',
- 'title': title,
- 'address': address,
- 'address_label': get_key_label('addr', user_language),
- 'url': url,
- 'osm': osm,
- 'geojson': geojson,
- 'img_src': img_src,
- 'links': links,
- 'data': data,
- 'type': get_tag_label(result.get('category'), result.get('type', ''), user_language),
- 'type_icon': result.get('icon'),
- 'content': '',
- 'longitude': result['lon'],
- 'latitude': result['lat'],
- 'boundingbox': result['boundingbox'],
- }
- )
+ results.append({
+ 'template': 'map.html',
+ 'title': title,
+ 'address': address,
+ 'address_label': get_key_label('addr', user_language),
+ 'url': url,
+ 'osm': osm,
+ 'geojson': geojson,
+ 'img_src': img_src,
+ 'links': links,
+ 'data': data,
+ 'type': get_tag_label(
+ result.get('category'), result.get('type', ''), user_language
+ ),
+ 'type_icon': result.get('icon'),
+ 'content': '',
+ 'longitude': result['lon'],
+ 'latitude': result['lat'],
+ 'boundingbox': result['boundingbox'],
+ })
- # return results
return results
@@ -353,13 +348,11 @@ def get_links(result, user_language):
url, url_label = mapping_function(raw_value)
if url.startswith('https://wikidata.org'):
url_label = result.get('wikidata', {}).get('itemLabel') or url_label
- links.append(
- {
- 'label': get_key_label(k, user_language),
- 'url': url,
- 'url_label': url_label,
- }
- )
+ links.append({
+ 'label': get_key_label(k, user_language),
+ 'url': url,
+ 'url_label': url_label,
+ })
link_keys.add(k)
return links, link_keys
@@ -379,13 +372,11 @@ def get_data(result, user_language, ignore_keys):
continue
k_label = get_key_label(k, user_language)
if k_label:
- data.append(
- {
- 'label': k_label,
- 'key': k,
- 'value': v,
- }
- )
+ data.append({
+ 'label': k_label,
+ 'key': k,
+ 'value': v,
+ })
data.sort(key=lambda entry: (get_key_rank(entry['key']), entry['label']))
return data
diff --git a/searx/static/themes/simple/less/style.less b/searx/static/themes/simple/less/style.less
index 017e61218..f9bb68c5e 100644
--- a/searx/static/themes/simple/less/style.less
+++ b/searx/static/themes/simple/less/style.less
@@ -330,9 +330,6 @@ article.result-images[data-vim-selected]::before {
text-align: left;
}
}
-
-
-
}
.torrent_result {
diff --git a/searx/templates/oscar/result_templates/map.html b/searx/templates/oscar/result_templates/map.html
index 6eea2c6d5..eb3fccfc0 100644
--- a/searx/templates/oscar/result_templates/map.html
+++ b/searx/templates/oscar/result_templates/map.html
@@ -59,7 +59,7 @@
<span><a class="text-info btn-collapse collapsed searx_init_map cursor-pointer disabled_if_nojs" data-toggle="collapse" data-target="#result-map-{{ index }}" data-leaflet-target="osm-map-{{ index }}" data-map-lon="{{ result.longitude }}" data-map-lat="{{ result.latitude }}" {% if result.boundingbox %}data-map-boundingbox='{{ result.boundingbox|tojson|safe }}'{% endif %} {% if result.geojson %}data-map-geojson='{{ result.geojson|tojson|safe }}'{% endif %} data-btn-text-collapsed="{{ _('show map') }}" data-btn-text-not-collapsed="{{ _('hide map') }}">{{ icon('globe') }} {{ _('show map') }}</a></span>
{%- endif -%}
</p>
-
+
</div>
{%- if (result.latitude and result.longitude) or result.boundingbox -%}