on master help sign in
Merge pull request #1671 from dalf/tidy-oscar

[mod] tidy oscar HTML output

commit50e1fcaa5e7369a64829552fc96cd24c787706c9 authorMarkus Heiser <markus.heiser@darmarIT.de> dateTue 10 Dec 2019, 16:02 (7 years ago) parentf7a05107fbb15e
12 files changed+339−347
searx/templates/oscar/advanced.html+5−4 searx/templates/oscar/base.html+12−9 searx/templates/oscar/categories.html+9−9 searx/templates/oscar/infobox.html+17−16 searx/templates/oscar/languages.html+7−7 searx/templates/oscar/macros.html+23−23 searx/templates/oscar/navbar.html+8−8 searx/templates/oscar/result_templates/default.html+31−31 searx/templates/oscar/result_templates/images.html+36−49 searx/templates/oscar/results.html+156−156 searx/templates/oscar/search.html+24−24 searx/templates/oscar/time-range.html+11−11
searx/templates/oscar/advanced.html+5−4
@@ -1,16 +1,17 @@
11<input type="checkbox" name="advanced_search" id="check-advanced" {% if advanced_search %} checked="checked"{% endif %}>
2−<label for="check-advanced">
2+<label for="check-advanced">{{- "" -}}
33 <span class="glyphicon glyphicon-cog"></span>
4− {{ _('Advanced settings') }}
4+ {{- _('Advanced settings') -}}
55</label>
66<div id="advanced-search-container">
77 {% include 'oscar/categories.html' %}
8+
89 <div class="row">
910 <div class="col-xs-6">
10− {% include 'oscar/time-range.html' %}
11+ {%- include 'oscar/time-range.html' -%}
1112 </div>
1213 <div class="col-xs-6">
13− {% include 'oscar/languages.html' %}
14+ {%- include 'oscar/languages.html' -%}
1415 </div>
1516 </div>
1617</div>
searx/templates/oscar/base.html+12−9
@@ -10,16 +10,17 @@
1010 <meta name="referrer" content="no-referrer">
1111 <meta name="viewport" content="width=device-width, initial-scale=1 , maximum-scale=1.0, user-scalable=1" />
1212 {% block meta %}{% endblock %}
13− <title>{% block title %}{% endblock %}{{ instance_name }}</title>
1413
14+ <title>{% block title %}{% endblock %}{{ instance_name }}</title>
1515 <link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}" type="text/css" />
16− {% if preferences.get_value('oscar-style') %}
17− <link rel="stylesheet" href="{{ url_for('static', filename='css/'+preferences.get_value('oscar-style')+'.min.css') }}" type="text/css" />
18− {% else %}
19− <link rel="stylesheet" href="{{ url_for('static', filename='css/logicodev.min.css') }}" type="text/css" />
20− {% endif %}
16+ {% if preferences.get_value('oscar-style') -%}
17+ {{' '}}<link rel="stylesheet" href="{{ url_for('static', filename='css/'+preferences.get_value('oscar-style')+'.min.css') }}" type="text/css" />
18+ {%- else -%}
19+ {{' '}}<link rel="stylesheet" href="{{ url_for('static', filename='css/logicodev.min.css') }}" type="text/css" />
20+ {%- endif %}
21+
2122 <link rel="stylesheet" href="{{ url_for('static', filename='css/leaflet.min.css') }}" type="text/css" />
22− {% for css in styles %}
23+ {%- for css in styles %}
2324 <link rel="stylesheet" href="{{ url_for('static', filename=css) }}" type="text/css" />
2425 {% endfor %}
2526
@@ -48,6 +49,7 @@
4849</head>
4950<body>
5051 {% include 'oscar/navbar.html' %}
52+
5153 <div class="container">
5254 {% if errors %}
5355 <div class="alert alert-danger fade in" role="alert">
@@ -93,13 +95,14 @@
9395 </div>
9496 <script src="{{ url_for('static', filename='js/jquery-1.11.1.min.js') }}"></script>
9597 <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
96− {% if autocomplete %}<script src="{{ url_for('static', filename='js/typeahead.bundle.min.js') }}"></script>{% endif %}
98+ {% if autocomplete %} <script src="{{ url_for('static', filename='js/typeahead.bundle.min.js') }}"></script>{% endif %}
99+
97100 <script src="{{ url_for('static', filename='js/require-2.1.15.min.js') }}"></script>
98101 <script src="{{ url_for('static', filename='js/searx.min.js') }}"
99102 data-method="{{ method or 'POST' }}"
100103 data-autocompleter="{% if autocomplete %}true{% else %}false{% endif %}"></script>
101104 {% for script in scripts %}
102− <script src="{{ url_for('static', filename=script) }}"></script>
105+ {{""}}<script src="{{ url_for('static', filename=script) }}"></script>
103106 {% endfor %}
104107 <noscript>
105108 <style>
searx/templates/oscar/categories.html+9−9
@@ -1,13 +1,13 @@
11<div id="categories">
2−{% if rtl %}
3− {% for category in categories | reverse %}
4− <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />
2+{%- if rtl -%}
3+ {% for category in categories | reverse -%}
4+ <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />{{- '' -}}
55 <label for="checkbox_{{ category|replace(' ', '_') }}">{{ _(category) }}</label>
6− {% endfor %}
7−{% else %}
8− {% for category in categories %}
9− <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />
6+ {%- endfor %}
7+{%- else -%}
8+ {% for category in categories -%}
9+ <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />{{- '' -}}
1010 <label for="checkbox_{{ category|replace(' ', '_') }}">{{ _(category) }}</label>
11− {% endfor %}
12−{% endif %}
11+ {%- endfor %}
12+{%- endif -%}
1313</div>
searx/templates/oscar/infobox.html+17−16
@@ -1,34 +1,35 @@
11{% from 'oscar/macros.html' import result_link with context %}
22<div class="panel panel-default infobox">
3− <div class="panel-heading">
4− <h4 class="panel-title infobox_part"><bdi>{{ infobox.infobox }}</bdi></h4>
3+ <div class="panel-heading">{{- "" -}}
4+ <h4 class="panel-title infobox_part"><bdi>{{ infobox.infobox }}</bdi></h4>{{- "" -}}
55 </div>
66 <div class="panel-body">
77 {% if infobox.img_src %}<img class="img-responsive center-block infobox_part" src="{{ image_proxify(infobox.img_src) }}" alt="{{ infobox.infobox }}" />{% endif %}
8− {% if infobox.content %}<bdi><p class="infobox_part">{{ infobox.content }}</bdi></p>{% endif %}
98
10− {% if infobox.attributes %}
9+ {% if infobox.content %}<bdi><p class="infobox_part">{{ infobox.content }}</p></bdi>{% endif %}
10+
11+ {% if infobox.attributes -%}
1112 <table class="table table-striped infobox_part">
12− {% for attribute in infobox.attributes %}
13− <tr>
13+ {% for attribute in infobox.attributes -%}
14+ <tr>{{- "" -}}
1415 <td><bdi>{{ attribute.label }}</bdi></td>
15− {% if attribute.image %}
16+ {%- if attribute.image -%}
1617 <td><img class="img-responsive" src="{{ image_proxify(attribute.image.src) }}" alt="{{ attribute.image.alt }}" /></td>
17− {% else %}
18+ {%- else -%}
1819 <td><bdi>{{ attribute.value }}</bdi></td>
19− {% endif %}
20+ {%- endif -%}
2021 </tr>
21− {% endfor %}
22+ {% endfor -%}
2223 </table>
2324 {% endif %}
2425
25− {% if infobox.urls %}
26− <div class="infobox_part">
26+ {% if infobox.urls -%}
27+ <div class="infobox_part">{{- "\n" -}}
2728 <bdi>
28− {% for url in infobox.urls %}
29− <p class="btn btn-default btn-xs">{{ result_link(url.url, url.title) }}</a></p>
30− {% endfor %}
31− </bdi>
29+ {%- for url in infobox.urls -%}
30+ <p class="btn btn-default btn-xs">{{ result_link(url.url, url.title) }}</p>
31+ {% endfor -%}
32+ </bdi>{{- "" -}}
3233 </div>
3334 {% endif %}
3435 </div>
searx/templates/oscar/languages.html+7−7
@@ -1,12 +1,12 @@
1−{% if preferences %}
1+{% if preferences -%}
22<select class="custom-select form-control" name='language'>
3−{% else %}
3+{%- else -%}
44<select class="time_range custom-select form-control" id='language' name='language'>
5−{% endif %}
5+{%- endif -%}
66 <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Default language') }}</option>
7− {% for lang_id,lang_name,country_name,english_name in language_codes | sort(attribute=1) %}
7+ {%- for lang_id,lang_name,country_name,english_name in language_codes | sort(attribute=1) -%}
88 <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>
9− {{ lang_name }} {% if country_name %}({{ country_name }}) {% endif %}- {{ lang_id }}
9+ {{- lang_name }} {% if country_name %}({{ country_name }}) {% endif %}- {{ lang_id -}}
1010 </option>
11− {% endfor %}
12−</select>
11+ {%- endfor -%}
12+</select>
searx/templates/oscar/macros.html+23−23
@@ -26,38 +26,38 @@
2626
2727<!-- Draw result footer -->
2828{% macro result_footer(result) -%}
29− <div class="clearfix"></div>
29+ <div class="clearfix"></div>{{- "" -}}
3030 <div class="pull-right">
31− {% for engine in result.engines %}
32− <span class="label label-default">{{ engine }}</span>
33− {% endfor %}
34− {% if result.url %}
35− <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small>
36− {% endif %}
37− {% if proxify %}
38− <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small>
39− {% endif %}
40−</div>
41−{% if result.pretty_url %}
42−<div class="external-link">{{ result.pretty_url }}</div>
43−{% endif %}
31+ {%- for engine in result.engines -%}
32+ <span class="label label-default">{{ engine }}</span>
33+ {%- endfor -%}
34+ {%- if result.url -%}
35+ <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small>
36+ {%- endif -%}
37+ {%- if proxify -%}
38+ <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small>
39+ {%- endif -%}
40+ </div>
41+ {%- if result.pretty_url -%}
42+ <div class="external-link">{{ result.pretty_url }}</div>
43+ {%- endif -%}
4444{%- endmacro %}
4545
4646<!-- Draw result footer -->
4747{% macro result_footer_rtl(result) -%}
48− <div class="clearfix"></div>
49− {% for engine in result.engines %}
48+ <div class="clearfix"></div>{{- "" -}}
49+ {% for engine in result.engines -%}
5050 <span class="label label-default">{{ engine }}</span>
51− {% endfor %}
52− {% if result.url %}
51+ {%- endfor %}
52+ {%- if result.url -%}
5353 <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small>
54− {% endif %}
55− {% if proxify %}
54+ {%- endif -%}
55+ {% if proxify -%}
5656 <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small>
57− {% endif %}
58− {% if result.pretty_url %}
57+ {%- endif %}
58+ {%- if result.pretty_url -%}
5959 <div class="external-link">{{ result.pretty_url }}</div>
60− {% endif %}
60+ {%- endif %}
6161{%- endmacro %}
6262
6363{% macro preferences_item_header(info, label, rtl) -%}
searx/templates/oscar/navbar.html+8−8
@@ -1,9 +1,9 @@
1−<div class="searx-navbar">
2− <span class="instance {% if rtl %}pull-right{% else %}pull-left{% endif%}">
3− <a href="{{ url_for('index') }}">{{ instance_name }}</a>
4− </span>
5− <span class="{% if rtl %}pull-left{% else %}pull-right{% endif %}">
6− <a href="{{ url_for('about') }}">{{ _('about') }}</a>
7− <a href="{{ url_for('preferences') }}">{{ _('preferences') }}</a>
8− </span>
1+<div class="searx-navbar">{{- "" -}}
2+ <span class="instance {% if rtl %}pull-right{% else %}pull-left{% endif%}">{{- "" -}}
3+ <a href="{{ url_for('index') }}">{{ instance_name }}</a>{{- "" -}}
4+ </span>{{- "" -}}
5+ <span class="{% if rtl %}pull-left{% else %}pull-right{% endif %}">{{- "" -}}
6+ <a href="{{ url_for('about') }}">{{ _('about') }}</a>{{- "" -}}
7+ <a href="{{ url_for('preferences') }}">{{ _('preferences') }}</a>{{- "" -}}
8+ </span>{{- "" -}}
99</div>
searx/templates/oscar/result_templates/default.html+31−31
@@ -1,31 +1,31 @@
1−{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon with context %}
2−
3−{{ result_header(result, favicons) }}
4−{{ result_sub_header(result) }}
5−
6−{% if result.embedded %}
7− <small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-media-{{ index }}" data-btn-text-collapsed="{{ _('show media') }}" data-btn-text-not-collapsed="{{ _('hide media') }}">{{ icon('music') }} {{ _('show media') }}</a></small>
8−{% endif %}
9−
10−{% if result.embedded %}
11−<div id="result-media-{{ index }}" class="collapse">
12− {{ result.embedded|safe }}
13−</div>
14−{% endif %}
15−
16−{% if result.img_src %}
17−<div class="container-fluid">
18− <div class="row">
19−<img src="{{ image_proxify(result.img_src) }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" style="width: auto; max-height: 60px; min-height: 60px;" class="col-xs-2 col-sm-4 col-md-4 result-content">
20−{% if result.content %}<p class="result-content col-xs-8 col-sm-8 col-md-8">{{ result.content|safe }}</p>{% endif %}
21− </div>
22−</div>
23−{% else %}
24−{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
25−{% endif %}
26−
27−{% if rtl %}
28−{{ result_footer_rtl(result) }}
29−{% else %}
30−{{ result_footer(result) }}
31−{% endif %}
1+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon with context %}
2+
3+{{- result_header(result, favicons) -}}
4+{{- result_sub_header(result) -}}
5+
6+{%- if result.embedded -%}
7+ <small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-media-{{ index }}" data-btn-text-collapsed="{{ _('show media') }}" data-btn-text-not-collapsed="{{ _('hide media') }}">{{ icon('music') }} {{ _('show media') }}</a></small>
8+{%- endif -%}
9+
10+{%- if result.embedded -%}
11+<div id="result-media-{{ index }}" class="collapse">
12+ {{ result.embedded|safe }}
13+</div>
14+{%- endif -%}
15+
16+{%- if result.img_src -%}
17+<div class="container-fluid">
18+ <div class="row">
19+<img src="{{ image_proxify(result.img_src) }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" style="width: auto; max-height: 60px; min-height: 60px;" class="col-xs-2 col-sm-4 col-md-4 result-content">
20+{% if result.content %}<p class="result-content col-xs-8 col-sm-8 col-md-8">{{ result.content|safe }}</p>{% endif -%}
21+ </div>
22+</div>
23+{%- else -%}
24+{%- if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif -%}
25+{%- endif -%}
26+
27+{%- if rtl -%}
28+{{ result_footer_rtl(result) }}
29+{%- else -%}
30+{{ result_footer(result) }}
31+{%- endif -%}
searx/templates/oscar/result_templates/images.html+36−49
@@ -1,49 +1,36 @@
1−{% from 'oscar/macros.html' import draw_favicon %}
2−
3−<a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} data-toggle="modal" data-target="#modal-{{ index }}-{{pageno}}">
4− <img src="{% if result.thumbnail_src %}{{ image_proxify(result.thumbnail_src) }}{% else %}{{ image_proxify(result.img_src) }}{% endif %}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" class="img-thumbnail">
5−</a>
6−
7−<div class="modal fade" id="modal-{{ index }}-{{ pageno }}" tabindex="-1" role="dialog" aria-hidden="true">
8− <div class="modal-dialog">
9− <div class="modal-wrapper">
10− <div class="modal-header">
11− <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
12− <h4 class="modal-title">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{{ result.title|striptags }}</h4>
13− </div>
14− <div class="modal-body">
15− <img class="img-responsive center-block" src="{% if result.thumbnail_src %}{{ image_proxify(result.thumbnail_src) }}{% else %}{{ image_proxify(result.img_src) }}{% endif %}" alt="{{ result.title|striptags }}">
16− {% if result.author %}<span class="photo-author">{{ result.author }}</span><br />{% endif %}
17− {% if result.content %}
18− <p class="result-content">
19− {{ result.content|striptags }}
20− </p>
21− {% endif %}
22− {% if result.img_format %}
23− <p class="result-format">
24− {{ result.img_format }}
25− </p>
26− {% endif %}
27− {% if result.source %}
28− <p class="result-source">
29− {{ result.source }}
30− </p>
31− {% endif %}
32− </div>
33− <div class="modal-footer">
34− <div class="clearfix"></div>
35− <span class="label label-default pull-right">{{ result.engine }}</span>
36− <p class="text-muted pull-left">{{ result.pretty_url }}</p>
37− <div class="clearfix"></div>
38− <div class="row">
39− <div class="col-md-6">
40− <a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} class="btn btn-default">{{ _('Get image') }}</a>
41− </div>
42− <div class="col-md-6">
43− <a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} class="btn btn-default">{{ _('View source') }}</a>
44− </div>
45− </div>
46− </div>
47− </div>
48− </div>
49−</div>
1+{%- from 'oscar/macros.html' import draw_favicon -%}
2+
3+<a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} data-toggle="modal" data-target="#modal-{{ index }}-{{pageno}}">{{- "" -}}
4+ <img src="{% if result.thumbnail_src %}{{ image_proxify(result.thumbnail_src) }}{% else %}{{ image_proxify(result.img_src) }}{% endif %}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" class="img-thumbnail">{{- "" -}}
5+</a>
6+<div class="modal fade" id="modal-{{ index }}-{{ pageno }}" tabindex="-1" role="dialog" aria-hidden="true">{{- "" -}}
7+ <div class="modal-dialog">{{- "" -}}
8+ <div class="modal-wrapper">{{- "" -}}
9+ <div class="modal-header">{{- "" -}}
10+ <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>{{- "" -}}
11+ <h4 class="modal-title">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{{ result.title|striptags }}</h4>{{- "" -}}
12+ </div>{{- "" -}}
13+ <div class="modal-body">{{- "" -}}
14+ <img class="img-responsive center-block" src="{% if result.thumbnail_src %}{{ image_proxify(result.thumbnail_src) }}{% else %}{{ image_proxify(result.img_src) }}{% endif %}" alt="{{ result.title|striptags }}">
15+ {%- if result.author %}<span class="photo-author">{{ result.author }}</span><br />{% endif -%}
16+ {%- if result.content %}<p class="result-content">{{ result.content|striptags }}</p>{% endif -%}
17+ {%- if result.img_format %}<p class="result-format">{{ result.img_format }}</p>{% endif -%}
18+ {%- if result.source %}<p class="result-source">{{ result.source }}</p>{% endif -%}
19+ </div>{{- "" -}}
20+ <div class="modal-footer">{{- "" -}}
21+ <div class="clearfix"></div>{{- "" -}}
22+ <span class="label label-default pull-right">{{ result.engine }}</span>{{- "" -}}
23+ <p class="text-muted pull-left">{{ result.pretty_url }}</p>{{- "" -}}
24+ <div class="clearfix"></div>{{- "" -}}
25+ <div class="row">{{- "" -}}
26+ <div class="col-md-6">{{- "" -}}
27+ <a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} class="btn btn-default">{{ _('Get image') }}</a>{{- "" -}}
28+ </div>{{- "" -}}
29+ <div class="col-md-6">{{- "" -}}
30+ <a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} class="btn btn-default">{{ _('View source') }}</a>{{- "" -}}
31+ </div>{{- "" -}}
32+ </div>{{- "" -}}
33+ </div>{{- "" -}}
34+ </div>{{- "" -}}
35+ </div>{{- "" -}}
36+</div>{{- "" -}}
searx/templates/oscar/results.html+156−156
@@ -1,156 +1,156 @@
1−{% extends "oscar/base.html" %}
2−{% macro search_form_attrs(pageno) -%}
3− {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %}
4− <input type="hidden" name="q" value="{{ q|e }}" />
5− <input type="hidden" name="pageno" value="{{ pageno }}" />
6− <input type="hidden" name="time_range" value="{{ time_range }}" />
7− <input type="hidden" name="language" value="{{ current_language }}" />
8− {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" />{% endif %}
9−{%- endmacro %}
10−{%- macro search_url() %}{{ base_url }}?q={{ q|urlencode }}{% if selected_categories %}&amp;categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if pageno > 1 %}&amp;pageno={{ pageno }}{% endif %}{% if time_range %}&amp;time_range={{ time_range }}{% endif %}{% if current_language != 'all' %}&amp;language={{ current_language }}{% endif %}{% endmacro -%}
11−
12−{% block title %}{{ q|e }} - {% endblock %}
13−{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ search_url() }}&amp;format=rss">{% endblock %}
14−{% block content %}
15− {% include 'oscar/search.html' %}
16− <div class="row">
17− <div class="col-sm-8" id="main_results">
18− <h1 class="sr-only">{{ _('Search results') }}</h1>
19−
20− {% if corrections %}
21− <div class="result">
22− <span class="result_header text-muted form-inline pull-left suggestion_item">{{ _('Try searching for:') }}</span>
23− {% for correction in corrections %}
24− <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-left suggestion_item">
25− <input type="hidden" name="q" value="{{ correction.url }}">
26− <button type="submit" class="btn btn-default btn-xs">{{ correction.title }}</button>
27− </form>
28− {% endfor %}
29− </div>
30− {% endif %}
31−
32− {% if answers %}
33− {% for answer in answers %}
34− <div class="result well">
35− <span>{{ answer }}</span>
36− </div>
37− {% endfor %}
38− {% endif %}
39−
40− {% for result in results %}
41− <div class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %}">
42− {% set index = loop.index %}
43− {% if result.template %}
44− {% include get_result_template('oscar', result['template']) %}
45− {% else %}
46− {% include 'oscar/result_templates/default.html' %}
47− {% endif %}
48− </div>
49− {% endfor %}
50−
51− {% if not results and not answers %}
52− {% include 'oscar/messages/no_results.html' %}
53− {% endif %}
54−
55− <div class="clearfix"></div>
56−
57− {% if paging %}
58− {% if rtl %}
59− <div id="pagination">
60− <div class="pull-left">
61− <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
62− {{ search_form_attrs(pageno+1) }}
63− <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-backward"></span> {{ _('next page') }}</button>
64− </form>
65− </div>
66− <div class="pull-right">
67− <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
68− {{ search_form_attrs(pageno-1) }}
69− <button type="submit" class="btn btn-default" {% if pageno == 1 %}disabled{% endif %}><span class="glyphicon glyphicon-forward"></span> {{ _('previous page') }}</button>
70− </form>
71− </div>
72− </div><!-- /#pagination -->
73− <div class="clearfix"></div>
74− {% else %}
75− <div id="pagination">
76− <div class="pull-left">
77− <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
78− {{ search_form_attrs(pageno-1) }}
79− <button type="submit" class="btn btn-default" {% if pageno == 1 %}disabled{% endif %}><span class="glyphicon glyphicon-backward"></span> {{ _('previous page') }}</button>
80− </form>
81− </div>
82− <div class="pull-right">
83− <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
84− {{ search_form_attrs(pageno+1) }}
85− <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-forward"></span> {{ _('next page') }}</button>
86− </form>
87− </div>
88− </div><!-- /#pagination -->
89− <div class="clearfix"></div>
90− {% endif %}
91− {% endif %}
92− </div><!-- /#main_results -->
93−
94− <div class="col-sm-4" id="sidebar_results">
95− {% if number_of_results != '0' %}
96− <p><small>{{ _('Number of results') }}: {{ number_of_results }}</small></p>
97− {% endif %}
98−
99− {% if unresponsive_engines and results|length >= 1 %}
100− <div class="alert alert-danger fade in" role="alert">
101− <p>{{ _('Engines cannot retrieve results') }}:</p>
102− {% for engine_name, error_type in unresponsive_engines %}
103− {{ engine_name }} ({{ error_type }}){% if not loop.last %}, {% endif %}
104− {% endfor %}
105− </div>
106− {% endif %}
107−
108− {% if infoboxes %}
109− {% for infobox in infoboxes %}
110− {% include 'oscar/infobox.html' %}
111− {% endfor %}
112− {% endif %}
113−
114− {% if suggestions %}
115− <div class="panel panel-default">
116− <div class="panel-heading">
117− <h4 class="panel-title">{{ _('Suggestions') }}</h4>
118− </div>
119− <div class="panel-body">
120− {% for suggestion in suggestions %}
121− <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} suggestion_item">
122− <input type="hidden" name="q" value="{{ suggestion.url }}">
123− <button type="submit" class="btn btn-default btn-xs">{{ suggestion.title }}</button>
124− </form>
125− {% endfor %}
126− </div>
127− </div>
128− {% endif %}
129−
130− <div class="panel panel-default">
131− <div class="panel-heading">
132− <h4 class="panel-title">{{ _('Links') }}</h4>
133− </div>
134− <div class="panel-body">
135− <form role="form">
136− <div class="form-group">
137− <label for="search_url">{{ _('Search URL') }}</label>
138− <input id="search_url" type="url" class="form-control select-all-on-click cursor-text" name="search_url" value="{{ search_url() }}" readonly>
139− </div>
140− </form>
141−
142− <label>{{ _('Download results') }}</label>
143− <div class="clearfix"></div>
144− {% for output_type in ('csv', 'json', 'rss') %}
145− <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} result_download">
146− {{ search_form_attrs(pageno) }}
147− <input type="hidden" name="format" value="{{ output_type }}">
148− <button type="submit" class="btn btn-default">{{ output_type }}</button>
149− </form>
150− {% endfor %}
151− <div class="clearfix"></div>
152− </div>
153− </div>
154− </div><!-- /#sidebar_results -->
155− </div>
156−{% endblock %}
1+{% extends "oscar/base.html" %}
2+{% macro search_form_attrs(pageno) -%}
3+ {%- for category in selected_categories -%}<input type="hidden" name="category_{{ category }}" value="1"/>{%- endfor -%}
4+ <input type="hidden" name="q" value="{{ q|e }}" />{{- "" -}}
5+ <input type="hidden" name="pageno" value="{{ pageno }}" />{{- "" -}}
6+ <input type="hidden" name="time_range" value="{{ time_range }}" />{{- "" -}}
7+ <input type="hidden" name="language" value="{{ current_language }}" />{{- "" -}}
8+ {% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" />{% endif -%}
9+{%- endmacro %}
10+{%- macro search_url() %}{{ base_url }}?q={{ q|urlencode }}{% if selected_categories %}&amp;categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if pageno > 1 %}&amp;pageno={{ pageno }}{% endif %}{% if time_range %}&amp;time_range={{ time_range }}{% endif %}{% if current_language != 'all' %}&amp;language={{ current_language }}{% endif %}{% endmacro -%}
11+
12+{% block title %}{{ q|e }} - {% endblock %}
13+{% block meta %}{{" "}}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ search_url() }}&amp;format=rss">{% endblock %}
14+{% block content %}
15+ {% include 'oscar/search.html' %}
16+
17+ <div class="row">
18+ <div class="col-sm-8" id="main_results">
19+ <h1 class="sr-only">{{ _('Search results') }}</h1>
20+
21+ {% if corrections -%}
22+ <div class="result">
23+ <span class="result_header text-muted form-inline pull-left suggestion_item">{{ _('Try searching for:') }}</span>
24+ {% for correction in corrections -%}
25+ <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-left suggestion_item">{{- "" -}}
26+ <input type="hidden" name="q" value="{{ correction.url }}">{{- "" -}}
27+ <button type="submit" class="btn btn-default btn-xs">{{ correction.title }}</button>{{- "" -}}
28+ </form>
29+ {% endfor %}
30+ </div>
31+ {%- endif %}
32+
33+ {% if answers -%}
34+ {%- for answer in answers %}
35+ <div class="result well">
36+ <span>{{ answer }}</span>
37+ </div>
38+ {%- endfor %}
39+ {%- endif %}
40+
41+ {% for result in results -%}
42+ <div class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %}">
43+ {%- set index = loop.index -%}
44+ {%- if result.template -%}
45+ {% include get_result_template('oscar', result['template']) %}
46+ {%- else -%}
47+ {% include 'oscar/result_templates/default.html' %}
48+ {%- endif -%}
49+ </div>
50+ {% endfor %}
51+
52+ {% if not results and not answers -%}
53+ {% include 'oscar/messages/no_results.html' %}
54+ {% endif %}
55+
56+ <div class="clearfix"></div>
57+
58+ {% if paging -%}
59+ {% if rtl %}
60+ <div id="pagination">
61+ <div class="pull-left">{{- "" -}}
62+ <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
63+ {{- search_form_attrs(pageno+1) -}}
64+ <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-backward"></span> {{ _('next page') }}</button>{{- "" -}}
65+ </form>{{- "" -}}
66+ </div>
67+ <div class="pull-right">{{- "" -}}
68+ <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
69+ {{- search_form_attrs(pageno-1) -}}
70+ <button type="submit" class="btn btn-default" {% if pageno == 1 %}disabled{% endif %}><span class="glyphicon glyphicon-forward"></span> {{ _('previous page') }}</button>{{- "" -}}
71+ </form>{{- "" -}}
72+ </div>
73+ </div><!-- /#pagination -->
74+ <div class="clearfix"></div>
75+ {% else %}
76+ <div id="pagination">
77+ <div class="pull-left">{{- "" -}}
78+ <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
79+ {{- search_form_attrs(pageno-1) -}}
80+ <button type="submit" class="btn btn-default" {% if pageno == 1 %}disabled{% endif %}><span class="glyphicon glyphicon-backward"></span> {{ _('previous page') }}</button>{{- "" -}}
81+ </form>{{- "" -}}
82+ </div>
83+ <div class="pull-right">{{- "" -}}
84+ <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
85+ {{- search_form_attrs(pageno+1) -}}
86+ <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-forward"></span> {{ _('next page') }}</button>{{- "" -}}
87+ </form>{{- "" -}}
88+ </div>
89+ </div><!-- /#pagination -->
90+ <div class="clearfix"></div>
91+ {% endif %}
92+ {% endif %}
93+ </div><!-- /#main_results -->
94+
95+ <div class="col-sm-4" id="sidebar_results">
96+ {% if number_of_results != '0' -%}
97+ <p><small>{{ _('Number of results') }}: {{ number_of_results }}</small></p>
98+ {%- endif %}
99+
100+ {% if unresponsive_engines and results|length >= 1 -%}
101+ <div class="alert alert-danger fade in" role="alert">
102+ <p>{{ _('Engines cannot retrieve results') }}:</p>
103+ {%- for engine_name, error_type in unresponsive_engines -%}AAAA
104+ {{- engine_name }} ({{ error_type }}){% if not loop.last %}, {% endif %}{{- "" -}}
105+ {%- endfor -%}
106+ </div>
107+ {%- endif %}
108+
109+ {% if infoboxes -%}
110+ {% for infobox in infoboxes %}
111+ {% include 'oscar/infobox.html' %}{{- "\n\n" -}}
112+ {% endfor %}
113+ {%- endif %}
114+
115+ {% if suggestions %}
116+ <div class="panel panel-default">
117+ <div class="panel-heading">
118+ <h4 class="panel-title">{{ _('Suggestions') }}</h4>
119+ </div>
120+ <div class="panel-body">
121+ {% for suggestion in suggestions %}
122+ <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" role="navigation" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} suggestion_item">
123+ <input type="hidden" name="q" value="{{ suggestion.url }}">
124+ <button type="submit" class="btn btn-default btn-xs">{{ suggestion.title }}</button>
125+ </form>
126+ {% endfor %}
127+ </div>
128+ </div>
129+ {%- endif %}
130+
131+ <div class="panel panel-default">
132+ <div class="panel-heading">{{- "" -}}
133+ <h4 class="panel-title">{{ _('Links') }}</h4>{{- "" -}}
134+ </div>
135+ <div class="panel-body">
136+ <form role="form">{{- "" -}}
137+ <div class="form-group">{{- "" -}}
138+ <label for="search_url">{{ _('Search URL') }}</label>{{- "" -}}
139+ <input id="search_url" type="url" class="form-control select-all-on-click cursor-text" name="search_url" value="{{ search_url() }}" readonly>{{- "" -}}
140+ </div>{{- "" -}}
141+ </form>
142+ <label>{{ _('Download results') }}</label>
143+ <div class="clearfix"></div>
144+ {% for output_type in ('csv', 'json', 'rss') %}
145+ <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} result_download">
146+ {{- search_form_attrs(pageno) -}}
147+ <input type="hidden" name="format" value="{{ output_type }}">{{- "" -}}
148+ <button type="submit" class="btn btn-default">{{ output_type }}</button>{{- "" -}}
149+ </form>
150+ {% endfor %}
151+ <div class="clearfix"></div>
152+ </div>
153+ </div>
154+ </div><!-- /#sidebar_results -->
155+ </div>
156+{% endblock %}
searx/templates/oscar/search.html+24−24
@@ -1,24 +1,24 @@
1−{% from 'oscar/macros.html' import icon %}
2−<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form" role="search">
3− <div class="row">
4− <div class="col-xs-12 col-md-8">
5− <div class="input-group search-margin">
6− <input type="search" name="q" class="form-control" id="q" placeholder="{{ _('Search for...') }}" aria-label="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}">
7− <span class="input-group-btn">
8− <button type="submit" class="btn btn-default" aria-label="{{ _('Start search') }}"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="hidden active_if_nojs">{{ _('Start search') }}</span></button>
9− </span>
10− </div>
11− </div>
12− <div class="col-xs-6 col-md-2 search-margin">
13− {% include 'oscar/time-range.html' %}
14− </div>
15− <div class="col-xs-6 col-md-2 search-margin">
16− {% include 'oscar/languages.html' %}
17− </div>
18− </div>
19− <div class="row">
20− <div class="col-sm-12">
21− {% include 'oscar/categories.html' %}
22− </div>
23− </div>
24−</form><!-- / #search_form_full -->
1+{% from 'oscar/macros.html' import icon %}
2+<form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form" role="search">
3+ <div class="row">
4+ <div class="col-xs-12 col-md-8">
5+ <div class="input-group search-margin">
6+ <input type="search" name="q" class="form-control" id="q" placeholder="{{ _('Search for...') }}" aria-label="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}">
7+ <span class="input-group-btn">
8+ <button type="submit" class="btn btn-default" aria-label="{{ _('Start search') }}"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="hidden active_if_nojs">{{ _('Start search') }}</span></button>
9+ </span>
10+ </div>
11+ </div>
12+ <div class="col-xs-6 col-md-2 search-margin">
13+ {%- include 'oscar/time-range.html' -%}
14+ </div>
15+ <div class="col-xs-6 col-md-2 search-margin">
16+ {%- include 'oscar/languages.html' -%}
17+ </div>
18+ </div>
19+ <div class="row">
20+ <div class="col-sm-12">
21+ {%- include 'oscar/categories.html' -%}
22+ </div>
23+ </div>
24+</form><!-- / #search_form_full -->
searx/templates/oscar/time-range.html+11−11
@@ -1,17 +1,17 @@
1−<select name="time_range" id="time-range" class="custom-select form-control">
1+<select name="time_range" id="time-range" class="custom-select form-control">{{- "" -}}
22 <option id="time-range-anytime" value="" {{ "selected" if time_range=="" or not time_range else ""}}>
3− {{ _('Anytime') }}
4− </option>
3+ {{- _('Anytime') -}}
4+ </option>{{- "" -}}
55 <option id="time-range-day" value="day" {{ "selected" if time_range=="day" else ""}}>
6− {{ _('Last day') }}
7− </option>
6+ {{- _('Last day') -}}
7+ </option>{{- "" -}}
88 <option id="time-range-week" value="week" {{ "selected" if time_range=="week" else ""}}>
9− {{ _('Last week') }}
10− </option>
9+ {{- _('Last week') -}}
10+ </option>{{- "" -}}
1111 <option id="time-range-month" value="month" {{ "selected" if time_range=="month" else ""}}>
12− {{ _('Last month') }}
13− </option>
12+ {{- _('Last month') -}}
13+ </option>{{- "" -}}
1414 <option id="time-range-year" value="year" {{ "selected" if time_range=="year" else ""}}>
15− {{ _('Last year') }}
16− </option>
15+ {{- _('Last year') -}}
16+ </option>{{- "" -}}
1717</select>