Browse Source

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

Html+Bugs in templates
Adam Tauber 10 years ago
parent
commit
f5aec98cbd

+ 1
- 1
searx/templates/courgette/result_templates/default.html View File

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

+ 1
- 1
searx/templates/courgette/result_templates/images.html View File

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

+ 1
- 1
searx/templates/courgette/result_templates/map.html View File

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

+ 2
- 4
searx/templates/courgette/result_templates/videos.html View File

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

+ 3
- 3
searx/templates/courgette/results.html View File

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

+ 2
- 1
searx/templates/default/infobox.html View File

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

+ 1
- 1
searx/templates/default/result_templates/default.html View File

@@ -1,5 +1,5 @@
1 1
 <div class="result {{ result.class }}">
2
-    <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>
2
+    <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>
3 3
     <p class="url">{{ result.pretty_url }} <a class="cache_link" href="https://web.archive.org/web/{{ result.url }}">cached</a></p>
4 4
     {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
5 5
     <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>

+ 1
- 1
searx/templates/default/result_templates/images.html View File

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

+ 1
- 1
searx/templates/default/result_templates/map.html View File

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

+ 2
- 3
searx/templates/default/result_templates/torrent.html View File

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

+ 2
- 4
searx/templates/default/result_templates/videos.html View File

@@ -1,8 +1,6 @@
1 1
 <div class="result">
2
-    <p>
3
-      <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>
2
+      <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>
4 3
       {% if result.publishedDate %}<p class="published_date">{{ result.publishedDate }}</p>{% endif %}
5
-      <a href="{{ result.url }}"><img class="thumbnail" src="{{ result.thumbnail }}" title={{ result.title }} alt=" {{ result.title }}"/></a>
4
+      <a href="{{ result.url }}"><img class="thumbnail" src="{{ result.thumbnail }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/></a>
6 5
       <p class="url">{{ result.url }}</p>
7
-    </p>
8 6
 </div>

+ 1
- 1
searx/templates/default/results.html View File

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

+ 1
- 1
searx/tests/test_webapp.py View File

@@ -49,7 +49,7 @@ class ViewsTestCase(SearxTestCase):
49 49
         )
50 50
         result = self.app.post('/', data={'q': 'test'})
51 51
         self.assertIn(
52
-            '<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
52
+            '<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
53 53
             result.data
54 54
         )
55 55
         self.assertIn(