[fix] static path fixed in templates and webapp, line endings fixed

This commit is contained in:
misnyo 2017-09-08 20:33:14 +02:00
parent f4df27fa59
commit ae99f9070c
5 changed files with 112 additions and 113 deletions

View File

@ -1,11 +1,11 @@
<div class="result {{ result.class }}"> <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 }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.title|safe }}</a></h3> <h3 class="result_title"><a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.title|safe }}</a></h3>
{% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %} {% if result.publishedDate %}<span class="published_date">{{ result.publishedDate }}</span>{% endif %}
<p class="content">{% if result.img_src %}<img src="{{ image_proxify(result.img_src) }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p> <p class="content">{% if result.img_src %}<img src="{{ image_proxify(result.img_src) }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p>
{% if result.repository %}<p class="content"><a href="{{ result.repository|safe }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.repository }}</a></p>{% endif %} {% if result.repository %}<p class="content"><a href="{{ result.repository|safe }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.repository }}</a></p>{% endif %}
<div dir="ltr"> <div dir="ltr">
{{ result.codelines|code_highlighter(result.code_language)|safe }} {{ result.codelines|code_highlighter(result.code_language)|safe }}
</div> </div>
<p class="url">{{ result.pretty_url }}&lrm;</p> <p class="url">{{ result.pretty_url }}&lrm;</p>
</div> </div>

View File

@ -1,11 +1,11 @@
<div class="result {{ result.class }}"> <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 }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.title|safe }}</a></h3> <h3 class="result_title"><a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.title|safe }}</a></h3>
<p class="url">{{ result.pretty_url }}&lrm; <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ _('cached') }}</a></p> <p class="url">{{ result.pretty_url }}&lrm; <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ _('cached') }}</a></p>
{% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %} {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
<p class="content">{% if result.img_src %}<img src="{{ image_proxify(result.img_src) }}" class="image" />{% endif %}{% if result.content %}{{ result.content|safe }}<br class="last"/>{% endif %}</p> <p class="content">{% if result.img_src %}<img src="{{ image_proxify(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 }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.repository }}</a></p>{% endif %} {% if result.repository %}<p class="result-content"><a href="{{ result.repository|safe }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.repository }}</a></p>{% endif %}
<div dir="ltr"> <div dir="ltr">
{{ result.codelines|code_highlighter(result.code_language)|safe }} {{ result.codelines|code_highlighter(result.code_language)|safe }}
</div> </div>
</div> </div>

View File

@ -1,88 +1,87 @@
<!-- Draw glyphicon icon from bootstrap-theme --> <!-- Draw glyphicon icon from bootstrap-theme -->
{% macro icon(action) -%} {% macro icon(action) -%}
<span class="glyphicon glyphicon-{{ action }}"></span> <span class="glyphicon glyphicon-{{ action }}"></span>
{%- endmacro %} {%- endmacro %}
<!-- Draw favicon --> <!-- Draw favicon -->
<!-- TODO: using url_for methode --> {% macro draw_favicon(favicon) -%}
{% macro draw_favicon(favicon) -%} <img width="32" height="32" class="favicon" src="{{ url_for('static', filename='/themes/oscar/img/icons/' + favicon + '.png') }}" alt="{{ favicon }}" />
<img width="32" height="32" class="favicon" src="static/themes/oscar/img/icons/{{ favicon }}.png" alt="{{ favicon }}" /> {%- endmacro %}
{%- endmacro %}
{%- macro result_link(url, title, classes='') -%}
{%- macro result_link(url, title, classes='') -%} <a href="{{ url }}" {% if classes %}class="{{ classes }}" {% endif %}{% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ title }}</a>
<a href="{{ url }}" {% if classes %}class="{{ classes }}" {% endif %}{% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ title }}</a> {%- endmacro -%}
{%- endmacro -%}
<!-- Draw result header -->
<!-- Draw result header --> {% macro result_header(result, favicons) -%}
{% macro result_header(result, favicons) -%} <h4 class="result_header">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{{ result_link(result.url, result.title|safe) }}</h4>
<h4 class="result_header">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{{ result_link(result.url, result.title|safe) }}</h4> {%- endmacro %}
{%- endmacro %}
<!-- Draw result sub header -->
<!-- Draw result sub header --> {% macro result_sub_header(result) -%}
{% macro result_sub_header(result) -%} {% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %} {% if result.magnetlink %}<small> &bull; {{ result_link(result.magnetlink, icon('magnet') + _('magnet link'), "magnetlink") }}</small>{% endif %}
{% if result.magnetlink %}<small> &bull; {{ result_link(result.magnetlink, icon('magnet') + _('magnet link'), "magnetlink") }}</small>{% endif %} {% if result.torrentfile %}<small> &bull; {{ result_link(result.torrentfile, icon('download-alt') + _('torrent file'), "torrentfile") }}</small>{% endif %}
{% if result.torrentfile %}<small> &bull; {{ result_link(result.torrentfile, icon('download-alt') + _('torrent file'), "torrentfile") }}</small>{% endif %} {%- endmacro %}
{%- endmacro %}
<!-- Draw result footer -->
<!-- Draw result footer --> {% macro result_footer(result) -%}
{% macro result_footer(result) -%} <div class="clearfix"></div>
<div class="clearfix"></div> <div class="pull-right">
<div class="pull-right"> {% for engine in result.engines %}
{% for engine in result.engines %} <span class="label label-default">{{ engine }}</span>
<span class="label label-default">{{ engine }}</span> {% endfor %}
{% endfor %} <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small>
<small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small> {% if proxify %}
{% if proxify %} <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small>
<small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small> {% endif %}
{% endif %} </div>
</div> <div class="external-link">{{ result.pretty_url }}</div>
<div class="external-link">{{ result.pretty_url }}</div> {%- endmacro %}
{%- endmacro %}
<!-- Draw result footer -->
<!-- Draw result footer --> {% macro result_footer_rtl(result) -%}
{% macro result_footer_rtl(result) -%} <div class="clearfix"></div>
<div class="clearfix"></div> {% for engine in result.engines %}
{% for engine in result.engines %} <span class="label label-default">{{ engine }}</span>
<span class="label label-default">{{ engine }}</span> {% endfor %}
{% endfor %} <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small>
<small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small> {% if proxify %}
{% if proxify %} <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small>
<small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small> {% endif %}
{% endif %} <div class="external-link">{{ result.pretty_url }}</div>
<div class="external-link">{{ result.pretty_url }}</div> {%- endmacro %}
{%- endmacro %}
{% macro preferences_item_header(info, label, rtl) -%}
{% macro preferences_item_header(info, label, rtl) -%} {% if rtl %}
{% if rtl %} <div class="row form-group">
<div class="row form-group"> <label class="col-sm-3 col-md-2 pull-right">{{ label }}</label>
<label class="col-sm-3 col-md-2 pull-right">{{ label }}</label> <span class="col-sm-5 col-md-6 help-block pull-left">{{ info }}</span>
<span class="col-sm-5 col-md-6 help-block pull-left">{{ info }}</span> <div class="col-sm-4 col-md-4">
<div class="col-sm-4 col-md-4"> {% else %}
{% else %} <div class="row form-group">
<div class="row form-group"> <label class="col-sm-3 col-md-2">{{ label }}</label>
<label class="col-sm-3 col-md-2">{{ label }}</label> <div class="col-sm-4 col-md-4">
<div class="col-sm-4 col-md-4"> {% endif %}
{% endif %} {%- endmacro %}
{%- endmacro %}
{% macro preferences_item_footer(info, label, rtl) -%}
{% macro preferences_item_footer(info, label, rtl) -%} {% if rtl %}
{% if rtl %} </div>
</div> </div>
</div> {% else %}
{% else %} </div>
</div> <span class="col-sm-5 col-md-6 help-block">{{ info }}</span>
<span class="col-sm-5 col-md-6 help-block">{{ info }}</span> </div>
</div> {% endif %}
{% endif %} {%- endmacro %}
{%- endmacro %}
{% macro checkbox_toggle(id, blocked) -%}
{% macro checkbox_toggle(id, blocked) -%} <div class="onoffswitch">
<div class="onoffswitch"> <input type="checkbox" id="{{ id }}" name="{{ id }}"{% if blocked %} checked="checked"{% endif %} class="onoffswitch-checkbox">
<input type="checkbox" id="{{ id }}" name="{{ id }}"{% if blocked %} checked="checked"{% endif %} class="onoffswitch-checkbox"> <label class="onoffswitch-label" for="{{ id }}">
<label class="onoffswitch-label" for="{{ id }}"> <span class="onoffswitch-inner"></span>
<span class="onoffswitch-inner"></span> <span class="onoffswitch-switch"></span>
<span class="onoffswitch-switch"></span> </label>
</label> </div>
</div> {%- endmacro %}
{%- endmacro %}

View File

@ -8,9 +8,8 @@
{%- endmacro %} {%- endmacro %}
<!-- Draw favicon --> <!-- Draw favicon -->
<!-- TODO: using url_for methode -->
{% macro draw_favicon(favicon) -%} {% macro draw_favicon(favicon) -%}
<img width="14" height="14" class="favicon" src="static/themes/simple/img/icons/{{ favicon }}.png" alt="{{ favicon }}" /> <img width="14" height="14" class="favicon" src="{{ url_for('static', filename='/themes/simple/img/icons/' + favicon + '.png') }}" alt="{{ favicon }}" />
{%- endmacro %} {%- endmacro %}
{% macro result_open_link(url, classes='') -%} {% macro result_open_link(url, classes='') -%}

View File

@ -792,7 +792,8 @@ def opensearch():
@app.route('/favicon.ico') @app.route('/favicon.ico')
def favicon(): def favicon():
return send_from_directory(os.path.join(app.root_path, return send_from_directory(os.path.join(app.root_path,
'static/themes', static_path,
'themes',
get_current_theme_name(), get_current_theme_name(),
'img'), 'img'),
'favicon.png', 'favicon.png',