summaryrefslogtreecommitdiff
path: root/searx/templates
diff options
context:
space:
mode:
Diffstat (limited to 'searx/templates')
-rw-r--r--searx/templates/courgette/result_templates/code.html9
-rw-r--r--searx/templates/default/result_templates/code.html9
-rw-r--r--searx/templates/oscar/macros.html25
-rw-r--r--searx/templates/oscar/result_templates/code.html12
-rw-r--r--searx/templates/oscar/result_templates/default.html13
-rw-r--r--searx/templates/oscar/result_templates/images.html4
-rw-r--r--searx/templates/oscar/result_templates/map.html14
-rw-r--r--searx/templates/oscar/result_templates/torrent.html13
-rw-r--r--searx/templates/oscar/result_templates/videos.html13
9 files changed, 74 insertions, 38 deletions
diff --git a/searx/templates/courgette/result_templates/code.html b/searx/templates/courgette/result_templates/code.html
new file mode 100644
index 000000000..616b7ea62
--- /dev/null
+++ b/searx/templates/courgette/result_templates/code.html
@@ -0,0 +1,9 @@
+<div class="result {{ result.class }}">
+ <h3 class="result_title"> {% if result['favicon'] %}<img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" alt="{{result['favicon']}}" />{% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
+ <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">cached</a></p>
+ {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
+ <p class="content">{% if result.img_src %}<img src="{{ result.img_src }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p>
+ {% if result.repository %}<p class="result-content"><a href="{{ result.repository|safe }}">{{ result.repository }}</a></p>{% endif %}
+
+ {{ result.codelines|code_highlighter(result.code_language)|safe }}
+</div>
diff --git a/searx/templates/default/result_templates/code.html b/searx/templates/default/result_templates/code.html
new file mode 100644
index 000000000..616b7ea62
--- /dev/null
+++ b/searx/templates/default/result_templates/code.html
@@ -0,0 +1,9 @@
+<div class="result {{ result.class }}">
+ <h3 class="result_title"> {% if result['favicon'] %}<img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" alt="{{result['favicon']}}" />{% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
+ <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">cached</a></p>
+ {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
+ <p class="content">{% if result.img_src %}<img src="{{ result.img_src }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p>
+ {% if result.repository %}<p class="result-content"><a href="{{ result.repository|safe }}">{{ result.repository }}</a></p>{% endif %}
+
+ {{ result.codelines|code_highlighter(result.code_language)|safe }}
+</div>
diff --git a/searx/templates/oscar/macros.html b/searx/templates/oscar/macros.html
index f61de2015..df604707d 100644
--- a/searx/templates/oscar/macros.html
+++ b/searx/templates/oscar/macros.html
@@ -1,3 +1,28 @@
+<!-- Draw glyphicon icon from bootstrap-theme -->
{% macro icon(action) -%}
<span class="glyphicon glyphicon-{{ action }}"></span>
{%- endmacro %}
+
+<!-- Draw favicon -->
+<!-- TODO: using url_for methode -->
+{% macro draw_favicon(favicon) -%}
+ <img width="32" height="32" class="favicon" src="static/themes/oscar/img/icons/{{ favicon }}.png" alt="{{ favicon }}" />
+{%- endmacro %}
+
+<!-- Draw result header -->
+{% macro result_header(result, favicons) -%}
+ <h4 class="result_header">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
+{%- endmacro %}
+
+<!-- Draw result sub header -->
+{% macro result_sub_header(result) -%}
+ {% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
+ <small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
+{%- endmacro %}
+
+<!-- Draw result footer -->
+{% macro result_footer(result) -%}
+ <div class="clearfix"></div>
+ <span class="label label-default pull-right">{{ result.engine }}</span>
+ <p class="text-muted">{{ result.pretty_url }}</p>
+{%- endmacro %}
diff --git a/searx/templates/oscar/result_templates/code.html b/searx/templates/oscar/result_templates/code.html
new file mode 100644
index 000000000..e608bb04f
--- /dev/null
+++ b/searx/templates/oscar/result_templates/code.html
@@ -0,0 +1,12 @@
+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %}
+
+{{ result_header(result, favicons) }}
+{{ result_sub_header(result) }}
+
+{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
+
+{% if result.repository %}<p class="result-content">{{ icon('file') }} <a href="{{ result.repository|safe }}">{{ result.repository }}</a></p>{% endif %}
+
+{{ result.codelines|code_highlighter(result.code_language)|safe }}
+
+{{ result_footer(result) }}
diff --git a/searx/templates/oscar/result_templates/default.html b/searx/templates/oscar/result_templates/default.html
index 25506b2f5..0bba4cec3 100644
--- a/searx/templates/oscar/result_templates/default.html
+++ b/searx/templates/oscar/result_templates/default.html
@@ -1,9 +1,7 @@
-{% from 'oscar/macros.html' import icon %}
+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %}
-<h4 class="result_header">{% if result.engine~".png" in favicons %}<img width="32" height="32" class="favicon" src="{{ url_for('static', filename='img/icons/'+result.engine+'.png') }}" alt="{{ result.engine }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
-
-{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
-<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
+{{ result_header(result, favicons) }}
+{{ result_sub_header(result) }}
{% if result.embedded %}
<small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader" 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>
@@ -19,7 +17,4 @@
{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
-<div class="clearfix"></div>
-
-<span class="label label-default pull-right">{{ result.engine }}</span>
-<p class="text-muted">{{ result.pretty_url }}</p>
+{{ result_footer(result) }}
diff --git a/searx/templates/oscar/result_templates/images.html b/searx/templates/oscar/result_templates/images.html
index 94627c9b5..7ad4e2435 100644
--- a/searx/templates/oscar/result_templates/images.html
+++ b/searx/templates/oscar/result_templates/images.html
@@ -1,3 +1,5 @@
+{% from 'oscar/macros.html' import draw_favicon %}
+
<a href="{{ result.img_src }}" data-toggle="modal" data-target="#modal-{{ index }}">
<img src="{{ result.img_src }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" class="img-thumbnail">
</a>
@@ -7,7 +9,7 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title">{% if result.engine~".png" in favicons %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result.engine }}.png" alt="{{ result.engine }}" /> {% endif %}{{ result.title|striptags }}</h4>
+ <h4 class="modal-title">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{{ result.title|striptags }}</h4>
</div>
<div class="modal-body">
<img class="img-responsive center-block" src="{{ result.img_src }}" alt="{{ result.title }}">
diff --git a/searx/templates/oscar/result_templates/map.html b/searx/templates/oscar/result_templates/map.html
index c08e2e72b..3552d84f8 100644
--- a/searx/templates/oscar/result_templates/map.html
+++ b/searx/templates/oscar/result_templates/map.html
@@ -1,10 +1,7 @@
-{% from 'oscar/macros.html' import icon %}
+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %}
-<h4 class="result_header">{% if result.engine~".png" in favicons %}<img width="32" height="32" class="favicon" src="{{ url_for('static', filename='img/icons/'+result.engine+'.png') }}" alt="{{ result.engine }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
-
-{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
-
-<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
+{{ result_header(result, favicons) }}
+{{ result_sub_header(result) }}
{% if (result.latitude and result.longitude) or result.boundingbox %}
<small> &bull; <a class="text-info btn-collapse collapsed searx_init_map cursor-pointer" 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></small>
@@ -68,7 +65,4 @@
</div>
{% endif %}
-<div class="clearfix"></div>
-
-<span class="label label-default pull-right">{{ result.engine }}</span>
-<p class="text-muted">{{ result.pretty_url }}</p>
+{{ result_footer(result) }}
diff --git a/searx/templates/oscar/result_templates/torrent.html b/searx/templates/oscar/result_templates/torrent.html
index bfb6cdbe6..9fec91f01 100644
--- a/searx/templates/oscar/result_templates/torrent.html
+++ b/searx/templates/oscar/result_templates/torrent.html
@@ -1,9 +1,7 @@
-{% from 'oscar/macros.html' import icon %}
+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %}
-<h4 class="result_header">{% if result.engine~".png" in favicons %}<img width="32" height="32" class="favicon" src="{{ url_for('static', filename='img/icons/'+result.engine+'.png') }}" alt="{{ result.engine }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
-
-{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
-<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
+{{ result_header(result, favicons) }}
+{{ result_sub_header(result) }}
<p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span>, {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span>
<br/>
@@ -11,7 +9,4 @@
{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
-<div class="clearfix"></div>
-
-<span class="label label-default pull-right">{{ result.engine }}</span>
-<p class="text-muted">{{ result.pretty_url }}</p>
+{{ result_footer(result) }}
diff --git a/searx/templates/oscar/result_templates/videos.html b/searx/templates/oscar/result_templates/videos.html
index 32000e662..709c7563f 100644
--- a/searx/templates/oscar/result_templates/videos.html
+++ b/searx/templates/oscar/result_templates/videos.html
@@ -1,9 +1,7 @@
-{% from 'oscar/macros.html' import icon %}
+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %}
-<h4 class="result_header">{% if result.engine~".png" in favicons %}<img width="32" height="32" class="favicon" src="{{ url_for('static', filename='img/icons/'+result.engine+'.png') }}" alt="{{ result.engine }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
-
-{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
-<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
+{{ result_header(result, favicons) }}
+{{ result_sub_header(result) }}
{% if result.embedded %}
<small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader" data-toggle="collapse" data-target="#result-video-{{ index }}" data-btn-text-collapsed="{{ _('show video') }}" data-btn-text-not-collapsed="{{ _('hide video') }}">{{ icon('film') }} {{ _('show video') }}</a></small>
@@ -24,7 +22,4 @@
</div>
</div>
-<div class="clearfix"></div>
-
-<span class="label label-default pull-right">{{ result.engine }}</span>
-<p class="text-muted">{{ result.pretty_url }}</p>
+{{ result_footer(result) }}