mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
Merge branch 'code_results' of https://github.com/pointhi/searx into pointhi-code_results
Conflicts: searx/static/themes/default/css/style.css searx/static/themes/oscar/css/oscar.min.css searx/templates/oscar/result_templates/torrent.html
This commit is contained in:
commit
a04fafd419
26 changed files with 456 additions and 1018 deletions
9
searx/templates/courgette/result_templates/code.html
Normal file
9
searx/templates/courgette/result_templates/code.html
Normal file
|
|
@ -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>
|
||||
9
searx/templates/default/result_templates/code.html
Normal file
9
searx/templates/default/result_templates/code.html
Normal file
|
|
@ -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>
|
||||
|
|
@ -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 %}
|
||||
|
|
|
|||
12
searx/templates/oscar/result_templates/code.html
Normal file
12
searx/templates/oscar/result_templates/code.html
Normal file
|
|
@ -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) }}
|
||||
|
|
@ -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> • <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>
|
||||
|
|
@ -17,7 +15,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) }}
|
||||
|
|
|
|||
|
|
@ -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">×</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 }}">
|
||||
|
|
|
|||
|
|
@ -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> • <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></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) }}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,21 @@
|
|||
{% from 'oscar/macros.html' import 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>
|
||||
{% if result.magnetlink %}<small> • <a href="{{ result.magnetlink }}" class="magnetlink">{{ icon('magnet') }} {{ _('magnet link') }}</a></small>{% endif %}
|
||||
{% if result.torrentfile %}<small> • <a href="{{ result.torrentfile }}" class="torrentfile">{{ icon('download-alt') }} {{ _('torrent file') }}</a></small>{% endif %}
|
||||
|
||||
<p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span> • {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span>
|
||||
{% if result.filesize %}<br />{{ icon('floppy-disk') }} {{ _('Filesize') }}
|
||||
<span class="badge">
|
||||
{% if result.filesize < 1024 %}{{ result.filesize }} {{ _('Bytes') }}
|
||||
{% elif result.filesize < 1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024) }} {{ _('kiB') }}
|
||||
{% elif result.filesize < 1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024) }} {{ _('MiB') }}
|
||||
{% elif result.filesize < 1024*1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024) }} {{ _('GiB') }}
|
||||
{% else %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024/1024) }} {{ _('TiB') }}{% endif %}
|
||||
</span>{% endif %}
|
||||
{% if result.files %}<br />{{ icon('file') }} {{ _('Number of Files') }} <span class="badge">{{ result.files }}</span>{% endif %}
|
||||
|
||||
{% if result.content %}<br />{{ result.content|safe }}{% endif %}
|
||||
|
||||
</p>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<span class="label label-default pull-right">{{ result.engine }}</span>
|
||||
<p class="text-muted">{{ result.pretty_url }}</p>
|
||||
{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %}
|
||||
|
||||
{{ 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>
|
||||
{% if result.filesize %}<br />{{ icon('floppy-disk') }} {{ _('Filesize') }}
|
||||
<span class="badge">
|
||||
{% if result.filesize < 1024 %}{{ result.filesize }} {{ _('Bytes') }}
|
||||
{% elif result.filesize < 1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024) }} {{ _('kiB') }}
|
||||
{% elif result.filesize < 1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024) }} {{ _('MiB') }}
|
||||
{% elif result.filesize < 1024*1024*1024*1024 %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024) }} {{ _('GiB') }}
|
||||
{% else %}{{ '{0:0.2f}'.format(result.filesize/1024/1024/1024/1024) }} {{ _('TiB') }}{% endif %}
|
||||
</span>{% endif %}
|
||||
{% if result.files %}<br />{{ icon('file') }} {{ _('Number of Files') }} <span class="badge">{{ result.files }}</span>{% endif %}
|
||||
|
||||
{% if result.content %}<br />{{ result.content|safe }}{% endif %}
|
||||
|
||||
</p>
|
||||
|
||||
{{ result_footer(result) }}
|
||||
|
|
|
|||
|
|
@ -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> • <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" 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>
|
||||
|
|
@ -22,7 +20,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) }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue