From 86e603e6c7d9c73d4272281a50fbe2c86e522e77 Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Mon, 6 Dec 2010 07:39:57 +0100 Subject: Minor improvements. Truncate title of articles on the main page when article's length exceed 110 characters. --- pyAggr3g470r.py | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'pyAggr3g470r.py') diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index 278026da..981a906e 100755 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -175,30 +175,30 @@ class Root: else: like = "" - # descrition for the CSS ToolTips + # Descrition for the CSS ToolTips article_content = utils.clear_string(article.article_description.encode('utf-8')) if article_content: description = " ".join(article_content[:500].split(' ')[:-1]) else: description = "No description." + # Title of the article + article_title = article.article_title.encode('utf-8') + if len(article_title) >= 110: + article_title = article_title[:110] + " ..." # a description line per article (date, title of the article and # CSS description tooltips on mouse over) html += article.article_date.encode('utf-8') + " - " + \ """%s%s%s%s""" % \ (feed.feed_id, article.article_id.encode('utf-8'), not_read_begin, \ - article.article_title.encode('utf-8')[:150], \ - not_read_end, description) + like + \ - "
\n" + article_title, not_read_end, description) + like + "
\n" html += "
\n" # some options for the current feed html += """All articles   """ % (feed.feed_id,) html += """  Mark all as read""" % (feed.feed_id,) if feed.nb_unread_articles != 0: - html += """     Unread article(s) (%s)""" % (feed.feed_id, \ - feed.nb_unread_articles) + html += """     Unread article(s) (%s)""" % (feed.feed_id, feed.nb_unread_articles) if feed.mail == "0": html += """
\nStay tuned""" % (feed.feed_id,) else: @@ -239,11 +239,9 @@ class Root: not_read_end = "" html += """
%s (%s%s%s / %s)
""" % \ - (feed.feed_id.encode('utf-8'), \ - feed.feed_title.encode('utf-8'), \ + (feed.feed_id.encode('utf-8'), feed.feed_title.encode('utf-8'), \ feed.feed_id, not_read_begin, \ - feed.nb_unread_articles, not_read_end, \ - feed.nb_articles) + feed.nb_unread_articles, not_read_end, feed.nb_articles) return html + "" @@ -302,7 +300,6 @@ class Root: html += '

Tag cloud

\n' html += '
' + \ utils.tag_cloud(self.top_words) + '
' - html += "
\n" html += htmlfooter return html @@ -315,6 +312,7 @@ class Root: Search for a feed. Simply search for the string 'querystring' in the description of the article. """ + print querystring param, _, value = querystring.partition(':') wordre = re.compile(r'\b%s\b' % param, re.I) feed_id = None @@ -323,11 +321,10 @@ class Root: html = htmlheader() html += htmlnav html += """
""" - html += """

Articles containing the string %s


""" % (querystring,) if feed_id is not None: - for article in self.articles[rss_feed_id]: + for article in self.feeds[feed_id].articles.values(): article_content = utils.clear_string(article.article_description.encode('utf-8')) if not article_content: utils.clear_string(article.article_title.encode('utf-8')) @@ -519,7 +516,6 @@ class Root: html += """
\n""" % \ (article_id,) - html += "
\n" + htmlfooter return html @@ -538,8 +534,7 @@ class Root: html += htmlnav html += """
\n""" html += """Mark all articles from this feed as read""" % (feed_id,) - html += """
\n
\n""" % (feed_id,) + html += """
\n
\n""" % ("Feed:"+feed_id,) html += "
\n" html += self.create_list_of_feeds() html += """
""" -- cgit