Merge pull request #145 from Cqoicebordel/HTML+Bugs-Templates

Html+Bugs in templates
This commit is contained in:
Adam Tauber 2014-12-13 23:27:49 +01:00
commit f5aec98cbd
13 changed files with 19 additions and 23 deletions

View file

@ -1,7 +1,7 @@
<div class="result {{ result.class }}"> <div class="result {{ result.class }}">
{% if result['favicon'] %} {% if result['favicon'] %}
<img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" /> <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" alt="{{result['favicon']}}" />
{% endif %} {% endif %}
<div> <div>

View file

@ -1,6 +1,6 @@
<div class="image_result"> <div class="image_result">
<p> <p>
<a href="{{ result.img_src }}"><img src="{{ result.img_src }}" title={{ result.title }}/></a> <a href="{{ result.img_src }}"><img src="{{ result.img_src }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/></a>
<span class="url"><a href="{{ result.url }}" class="small_font">original context</a></span> <span class="url"><a href="{{ result.url }}" class="small_font">original context</a></span>
</p> </p>
</div> </div>

View file

@ -1,7 +1,7 @@
<div class="result {{ result.class }}"> <div class="result {{ result.class }}">
{% if result['favicon'] %} {% if result['favicon'] %}
<img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" /> <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" alt="{{result['favicon']}}" />
{% endif %} {% endif %}
<div> <div>

View file

@ -1,12 +1,10 @@
<div class="result"> <div class="result">
{% if result['favicon'] %} {% if result['favicon'] %}
<img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" /> <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" alt="{{result['favicon']}}" />
{% endif %} {% endif %}
<p>
<h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3> <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
{% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %} {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
<a href="{{ result.url }}"><img width="400px" src="{{ result.thumbnail }}" title={{ result.title }} alt=" {{ result.title }}"/></a> <a href="{{ result.url }}"><img width="400" src="{{ result.thumbnail }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/></a>
<p class="url">{{ result.url }}</p> <p class="url">{{ result.url }}</p>
</p>
</div> </div>

View file

@ -10,7 +10,7 @@
<div id="search_url"> <div id="search_url">
{{ _('Search URL') }}: {{ _('Search URL') }}:
<input type="text" value="{{ base_url }}?q={{ q|urlencode }}&pageno={{ pageno }}{% if selected_categories %}&category_{{ selected_categories|join("&category_") }}{% endif %}" readonly="" /> <input type="text" value="{{ base_url }}?q={{ q|urlencode }}&amp;pageno={{ pageno }}{% if selected_categories %}&amp;category_{{ selected_categories|join("&category_")|replace(' ','+') }}{% endif %}" readonly />
</div> </div>
<div id="apis"> <div id="apis">
{{ _('Download results') }} {{ _('Download results') }}
@ -43,9 +43,9 @@
{% for result in results %} {% for result in results %}
{% if result['template'] %} {% if result['template'] %}
{% include 'default/result_templates/'+result['template'] %} {% include 'courgette/result_templates/'+result['template'] %}
{% else %} {% else %}
{% include 'default/result_templates/default.html' %} {% include 'courgette/result_templates/default.html' %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View file

@ -1,6 +1,6 @@
<div class="infobox"> <div class="infobox">
<h2>{{ infobox.infobox }}</h2> <h2>{{ infobox.infobox }}</h2>
{% if infobox.img_src %}<img src="{{ infobox.img_src }}" />{% endif %} {% if infobox.img_src %}<img src="{{ infobox.img_src }}" title="{{ infobox.infobox|striptags }}" alt="{{ infobox.infobox|striptags }}" />{% endif %}
<p>{{ infobox.entity }}</p> <p>{{ infobox.entity }}</p>
<p>{{ infobox.content | safe }}</p> <p>{{ infobox.content | safe }}</p>
{% if infobox.attributes %} {% if infobox.attributes %}
@ -42,3 +42,4 @@
<br /> <br />
</div> </div>
name=

View file

@ -1,5 +1,5 @@
<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" />{% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3> <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> <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 %} {% 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> <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>

View file

@ -1,6 +1,6 @@
<div class="image_result"> <div class="image_result">
<p> <p>
<a href="{{ result.img_src }}"><img src="{{ result.img_src }}" title="{{ result.title }}"/></a> <a href="{{ result.img_src }}"><img src="{{ result.img_src }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}" /></a>
<span class="url"><a href="{{ result.url }}" class="small_font">original context</a></span> <span class="url"><a href="{{ result.url }}" class="small_font">original context</a></span>
</p> </p>
</div> </div>

View file

@ -1,7 +1,7 @@
<div class="result {{ result.class }}"> <div class="result {{ result.class }}">
{% if result['favicon'] %} {% if result['favicon'] %}
<img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" /> <img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" alt="{{result['favicon']}}" />
{% endif %} {% endif %}
<div> <div>

View file

@ -1,7 +1,6 @@
<div class="result torrent_result"> <div class="result torrent_result">
<h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3> <h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
{% if result.content %}<p class="content">{{ result.content|safe }}</p>{% endif %}
<p class="stats">Seed: {{ result.seed }}, Leech: {{ result.leech }}</p>
<p><a href="{{ result.magnetlink }}" class="magnetlink">magnet link</a></p>
<p class="url">{{ result.pretty_url }}</p> <p class="url">{{ result.pretty_url }}</p>
{% if result.content %}<p class="content">{{ result.content|safe }}</p>{% endif %}
<p><a href="{{ result.magnetlink }}" class="magnetlink">magnet link</a> - <span class="stats">Seed: {{ result.seed }}, Leech: {{ result.leech }}</span></p>
</div> </div>

View file

@ -1,8 +1,6 @@
<div class="result"> <div class="result">
<p> <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>
<h3 class="result_title"> {% if result['favicon'] %}<img width="14" height="14" class="favicon" src="static/{{theme}}/img/icon_{{result['favicon']}}.ico" />{% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
{% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %} {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
<a href="{{ result.url }}"><img class="thumbnail" src="{{ result.thumbnail }}" title={{ result.title }} alt=" {{ result.title }}"/></a> <a href="{{ result.url }}"><img class="thumbnail" src="{{ result.thumbnail }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/></a>
<p class="url">{{ result.url }}</p> <p class="url">{{ result.url }}</p>
</p>
</div> </div>

View file

@ -10,7 +10,7 @@
<div id="search_url"> <div id="search_url">
{{ _('Search URL') }}: {{ _('Search URL') }}:
<input type="text" value="{{ base_url }}?q={{ q|urlencode }}&pageno={{ pageno }}{% if selected_categories %}&category_{{ selected_categories|join("&category_") }}{% endif %}" readonly="" /> <input type="text" value="{{ base_url }}?q={{ q|urlencode }}&amp;pageno={{ pageno }}{% if selected_categories %}&amp;category_{{ selected_categories|join("&category_")|replace(' ','+') }}{% endif %}" readonly />
</div> </div>
<div id="apis"> <div id="apis">
{{ _('Download results') }} {{ _('Download results') }}

View file

@ -49,7 +49,7 @@ class ViewsTestCase(SearxTestCase):
) )
result = self.app.post('/', data={'q': 'test'}) result = self.app.post('/', data={'q': 'test'})
self.assertIn( self.assertIn(
'<h3 class="result_title"> <img width="14" height="14" class="favicon" src="static/default/img/icon_youtube.ico" /><a href="http://first.test.xyz">First <span class="highlight">Test</span></a></h3>', # noqa '<h3 class="result_title"> <img width="14" height="14" class="favicon" src="static/default/img/icon_youtube.ico" alt="youtube" /><a href="http://first.test.xyz">First <span class="highlight">Test</span></a></h3>', # noqa
result.data result.data
) )
self.assertIn( self.assertIn(