From bbba5375973dc12888d1cb118772fef18a4a5993 Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Wed, 3 Mar 2010 08:10:19 +0100 Subject: Added a link to read articles in plain text (without HTML tags). --- pyAggr3g470r.py | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) (limited to 'pyAggr3g470r.py') diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index 60087c2a..49d99e0b 100644 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -284,18 +284,20 @@ class Root: if article[5] == "0": self.mark_as_read("Article:"+article[3]) # update the database - html += """

%s from %s


""" % \ - (article[2].encode('utf-8'), rss_feed_id, \ - self.feeds[rss_feed_id][3].encode('utf-8')) + html += """

%s from %s

\n
\n""" % \ + (article[2].encode('utf-8'), rss_feed_id, \ + self.feeds[rss_feed_id][3].encode('utf-8')) description = article[4].encode('utf-8') if description: html += description else: html += "No description available." - html += "
\n" - html += """This article seems to be written in %s.""" % \ + html += "\n
\n" + html += """This article seems to be written in %s.\n""" % \ (article[6], article[6]) - html += """
Complete story\n
\n""" % \ + html += """
\nPlain text\n""" % \ + (rss_feed_id, article_id) + html += """
\nComplete story\n
\n""" % \ (article[3].encode('utf-8'),) # Share this article: # on delicious @@ -439,6 +441,30 @@ class Root: language.exposed = True + def plain_text(self, target): + """ + Display an article in plain text (without HTML tags). + """ + html = htmlheader + html += htmlnav + html += """
""" + feed_id, article_id = target.split(':') + for article in self.articles[feed_id]: + if article_id == article[0]: + html += """

%s from %s

\n
\n"""% \ + (article[2].encode('utf-8'), feed_id, \ + self.feeds[feed_id][3].encode('utf-8')) + description = utils.remove_html_tags(article[4].encode('utf-8')) + if description: + html += description + else: + html += "No description available." + html += "\n
\n" + htmlfooter + return html + + plain_text.exposed = True + + def mark_as_read(self, target): """ Mark one (or more) article(s) as read by setting the value of the field -- cgit