aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rwxr-xr-xsource/pyAggr3g470r.py21
-rw-r--r--source/templates/plain_text.html19
2 files changed, 29 insertions, 11 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py
index 9a16d437..de436ff4 100755
--- a/source/pyAggr3g470r.py
+++ b/source/pyAggr3g470r.py
@@ -43,6 +43,10 @@ import re
import cherrypy
import calendar
+from mako.template import Template
+from mako.lookup import TemplateLookup
+lookup = TemplateLookup(directories=['templates'])
+
from collections import Counter
import datetime
@@ -947,18 +951,13 @@ 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()
- html += htmlnav
- html += """<div class="left inner">"""
- html += """<h1><i>%s</i> from <a href="/articles/%s">%s</a></h1>\n<br />\n"""% \
- (article["article_title"], feed_id, feed["feed_title"])
description = utils.clear_string(article["article_content"])
- if description:
- html += description
- else:
- html += "No description available."
- html += "\n<hr />\n" + htmlfooter
- return html
+ if not description:
+ description += "Unvailable"
+ tmpl = lookup.get_template("plain_text.html")
+ return tmpl.render(feed_title=feed["feed_title"], \
+ article_title=article["article_title"], \
+ description = description)
plain_text.exposed = True
diff --git a/source/templates/plain_text.html b/source/templates/plain_text.html
new file mode 100644
index 00000000..8bd606de
--- /dev/null
+++ b/source/templates/plain_text.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>pyAggr3g470r - News aggregator</title>
+ <link rel="stylesheet" type="text/css" href="/css/style.css" />
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
+</head>
+<body>
+<div class="left inner">
+ <h1><i>${article_title}</i> from <a href="/articles/%s">${feed_title}</a></h1><br />
+ ${description}
+ <hr />
+ <p>This software is under GPLv3 license. You are welcome to copy, modify or
+ redistribute the source code according to the
+ <a href="http://www.gnu.org/licenses/gpl-3.0.txt">GPLv3</a> license.</p>
+</div>
+</body>
+</html>
bgstack15