blob: e4a4ac9c10bf47dda356fbb9af2fe9b3d04e9a3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
## search.html
<%inherit file="base.html"/>
<%
import re
import utils
%>
<div class="left inner">
<h1>Articles containing the string <i>${query}</i></h1>
<br />
<%
html = ""
%>
%if feed_id is None:
%for feed in feeds:
<%
new_feed_section = True
for article in mongo.get_articles(feed["feed_id"]):
article_content = utils.clear_string(article["article_content"])
if not article_content:
utils.clear_string(article["article_title"])
if wordre.findall(article_content) != []:
if new_feed_section is True:
new_feed_section = False
html += """<h2><a href="/articles/%s" rel="noreferrer" target="_blank">%s</a><a href="%s" rel="noreferrer" target="_blank"><img src="%s" width="28" height="28" /></a></h2>\n""" % \
(feed["feed_id"], feed["feed_title"], feed["feed_link"], feed["feed_image"])
if article["article_readed"] == False:
# not readed articles are in bold
not_read_begin, not_read_end = "<b>", "</b>"
else:
not_read_begin, not_read_end = "", ""
# display a heart for faved articles
if article["article_like"] == True:
like = """ <img src="/img/heart.png" title="I like this article!" />"""
else:
like = ""
# descrition for the CSS ToolTips
article_content = utils.clear_string(article["article_content"])
if article_content:
description = " ".join(article_content[:500].split(' ')[:-1])
else:
description = "No description."
# a description line per article (date, title of the article and
# CSS description tooltips on mouse over)
html += article["article_date"].strftime('%Y-%m-%d %H:%M') + " - " + \
"""<a class="tooltip" href="/article/%s:%s" rel="noreferrer" target="_blank">%s%s%s<span class="classic">%s</span></a>""" % \
(feed["feed_id"], article["article_id"], not_read_begin, \
article["article_title"][:150], not_read_end, description) + like + "<br />\n"
%>
%endfor
%endif
${html}
|