From 929284e297a239171b8573620d8503bdb4195059 Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Fri, 26 Feb 2010 22:17:25 +0100 Subject: Better HTML output. --- pyAggr3g470r.py | 64 +++++++++++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 27 deletions(-) (limited to 'pyAggr3g470r.py') diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index 2fe75bd6..a359cdb6 100644 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -42,19 +42,20 @@ path = {'/css/style.css': {'tools.staticfile.on': True, \ '/var/histogram.png':{'tools.staticfile.on': True, \ 'tools.staticfile.filename':path+'var/histogram.png'}} -htmlheader = """\n\n\n\n - pyAggr3g470r - RSS Feed Reader """ +htmlheader = '\n' + \ + '' + \ + '\n\tpyAggr3g470r - RSS Feed Reader\n' + \ + '\t' + \ + '\n\t\n' + \ + '\n' -htmlfooter = """

This software is under GPLv3 license. You are welcome to copy, modify or - redistribute the source code according to the GPLv3 license.

\n - \n""" +htmlfooter = '

This software is under GPLv3 license. You are welcome to copy, modify or' + \ + 'redistribute the source code according to the GPLv3 license.

\n' + \ + '\n' -htmlnav = """\n

pyAggr3g470r - RSS Feed Reader

\n -pyAggr3g470r (source code) -""" +htmlnav = '\n

pyAggr3g470r - RSS Feed Reader

\n' + \ + 'pyAggr3g470r (source code)' class Root: @@ -66,9 +67,9 @@ class Root: html = htmlheader html += htmlnav html += """
\n""" - html += """Fetch all feeds\n
\n""" - html += """Mark all articles as read\n
\n""" - html += """Management of feed\n""" + html += """Management
\n""" + html += """Fetch all feeds
\n""" + html += """Mark articles as read\n""" html += """
\n""" html += "
\n" @@ -148,8 +149,8 @@ class Root: html += "
\n" - html += """

The database contains a total of %s articles with - %s unread articles.
""" % \ + html += """

The database contains a total of %s article(s) with + %s unread article(s).
""" % \ (sum([feed[0] for feed in self.feeds.values()]), sum([feed[1] for feed in self.feeds.values()])) html += """Database: %s.\n
Size: %s bytes.

\n""" % \ @@ -362,19 +363,28 @@ class Root: html = htmlheader html += htmlnav html += """
""" - html += """

Unread article(s) of the feed %s

-
""" % (feed_id, self.feeds[feed_id][3].encode('utf-8')) - - for article in self.articles[feed_id]: - - if article[5] == "0": - html += article[1].encode('utf-8') + \ - """ - %s""" % \ - (article[0].encode('utf-8'), article[2].encode('utf-8')) + \ - "
\n" + if feed_id == "All": + html += "

Unread article(s)

" + for rss_feed_id in self.feeds.keys(): + for article in self.articles[rss_feed_id]: + if article[5] == "0": + html += article[1].encode('utf-8') + \ + """ - %s""" % \ + (article[0].encode('utf-8'), article[2].encode('utf-8')) + \ + "
\n" + html += """
\nMark articles as read\n""" + else: + html += """

Unread article(s) of the feed %s

+
""" % (feed_id, self.feeds[feed_id][3].encode('utf-8')) + for article in self.articles[feed_id]: + if article[5] == "0": + html += article[1].encode('utf-8') + \ + """ - %s""" % \ + (article[0].encode('utf-8'), article[2].encode('utf-8')) + \ + "
\n" - html += """
\nMark all as read""" % (feed_id,) + html += """
\nMark all as read""" % (feed_id,) html += """\n

All feeds

""" html += "
\n" html += htmlfooter -- cgit