From b8461109b3e3a6074f91f4a672f6ba0d2d47d663 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 22 Nov 2012 13:55:16 +0100 Subject: Template for the /article page. --- source/pyAggr3g470r.py | 90 +++---------------------------------------- source/templates/article.html | 61 +++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 85 deletions(-) create mode 100644 source/templates/article.html (limited to 'source') diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index 43023a1a..a8659e1a 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -451,40 +451,21 @@ class pyAggr3g470r(object): article = self.mongo.get_article(feed_id, article_id) except: return self.error_page("Bad URL. This article do not exists.") - html = htmlheader(article["article_title"]) - html += htmlnav - html += """
""" if article["article_readed"] == False: # if the current article is not yet readed, update the database self.mark_as_read("Article:"+article["article_id"]+":"+feed["feed_id"]) - html += '\n
\n' - # Title of the article - html += """

%s from %s

\n
\n""" % \ - (article["article_title"], feed_id, feed["feed_title"]) - if article["article_like"] == True: - html += """""" % \ - (feed_id, article["article_id"]) - else: - html += """""" % \ - (feed_id, article["article_id"]) - html += """  """ % \ - (feed_id, article["article_id"]) - html += "

" - # Description (full content) of the article description = article["article_content"] if description: p = re.compile(r'<') q = re.compile(r'>') - description = p.sub('<', description) description = q.sub('>', description) - - html += description + "\n


" + description = description + "\n


" else: - html += "No description available.\n


" + description += "No description available.\n


" """ # Generation of the QR Code for the current article try: @@ -517,70 +498,9 @@ class pyAggr3g470r(object): except StopIteration: previous = liste[0] - html += """
\n""" % \ - (feed_id, following["article_id"], following["article_title"]) - html += """
\n""" % \ - (feed_id, previous["article_id"], previous["article_title"]) - - html += "\n
\n" - - # Footer menu - html += "
\n" - html += """\nPlain text\n""" % (feed_id, article["article_id"]) - html += """ - Export to EPUB\n""" % (feed_id, article["article_id"]) - html += """
\nComplete story\n
\n""" % (article["article_link"],) - - # Share this article: - html += "Share this article:
\n" - # on Diaspora - html += """\n\t - \n""" % \ - (conf.DIASPORA_POD, article["article_link"], article["article_title"], "via pyAggr3g470r") - - # on Identi.ca - html += """\n\n""" % \ - (article["article_title"], article["article_link"]) - - # on Hacker News - html += """\n\n""" % \ - (article["article_link"], article["article_title"]) - - # on Pinboard - html += """\n\n\t\n - """ % \ - (article["article_link"], article["article_title"]) - - # on Digg - html += """\n\n\t\n - """ % \ - (article["article_link"], article["article_title"]) - # on reddit - html += """\n\n\t\n - """ % \ - (article["article_link"], article["article_title"]) - # on Scoopeo - html += """\n\n\t\n - """ % \ - (article["article_link"], article["article_title"]) - # on Blogmarks - html += """\n\n\t\n - """ % \ - (article["article_link"], article["article_title"]) - - # Google +1 button - html += """\n\n""" % \ - (article["article_link"],) - - - # QRCode (for smartphone) - html += """
\n""" % (article_id, article_id) - html += "
\n" + htmlfooter - return html + tmpl = lookup.get_template("article.html") + return tmpl.render(article=article, previous=previous, following=following, \ + diaspora=conf.DIASPORA_POD, feed=feed, description=description) article.exposed = True diff --git a/source/templates/article.html b/source/templates/article.html new file mode 100644 index 00000000..110442f6 --- /dev/null +++ b/source/templates/article.html @@ -0,0 +1,61 @@ +## article.html +<%inherit file="base.html"/> +

pyAggr3g470r - News aggregator

+pyAggr3g470r (source code) +
+
+

${article["article_title"]} from ${feed["feed_title"]}

+
+ %if article["article_like"]: + + %else: + + %endif +    +

+ + ${description} + +
+
+
+ +
+ Plain text + - Export to EPUB +
+ Complete story +
+ + Share this article:
+ + + + + + + + + + + + + + + + + + + + + + + +
+ \ No newline at end of file -- cgit