diff options
-rwxr-xr-x | source/pyAggr3g470r.py | 27 | ||||
-rw-r--r-- | source/static/templates/article.html | 2 | ||||
-rw-r--r-- | source/static/templates/plain_text.html | 5 |
3 files changed, 6 insertions, 28 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index c90dfcb4..e7beac47 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -192,7 +192,7 @@ class pyAggr3g470r(object): fetch.exposed = True @auth.require() - def article(self, param): + def article(self, param, plain_text=0): """ Display the article in parameter in a new Web page. """ @@ -209,7 +209,10 @@ class pyAggr3g470r(object): self.mark_as_read("Article:"+article["article_id"]+":"+feed["feed_id"]) # Description (full content) of the article - description = article["article_content"] + if plain_text == "1": + description = utils.clear_string(article["article_content"]) + else: + description = article["article_content"] if description: p = re.compile(r'<code><') q = re.compile(r'></code>') @@ -332,26 +335,6 @@ class pyAggr3g470r(object): history.exposed = True @auth.require() - def plain_text(self, target): - """ - Display an article in plain text (without HTML tags). - """ - try: - feed_id, article_id = target.split(':') - feed = self.mongo.get_feed(feed_id) - article = self.mongo.get_articles(feed_id, article_id) - except: - return self.error("<p>Bad URL. This article do not exists.</p>") - description = utils.clear_string(article["article_content"]) - 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 - - @auth.require() def error(self, message): """ Display a message (bad feed id, bad article id, etc.) diff --git a/source/static/templates/article.html b/source/static/templates/article.html index 9225993a..123aaa9f 100644 --- a/source/static/templates/article.html +++ b/source/static/templates/article.html @@ -19,7 +19,7 @@ </div> <hr /> - <a href="/plain_text/${feed['feed_id']}:${article['article_id']}">Plain text</a> + <a href="/article/${feed['feed_id']}:${article['article_id']}/?plain_text=1">Plain text</a> - <a href="/epub/${feed['feed_id']}:${article['article_id']}">Export to EPUB</a> <br /> <a href="${article['article_link']}">Complete story</a> diff --git a/source/static/templates/plain_text.html b/source/static/templates/plain_text.html deleted file mode 100644 index 44b7da91..00000000 --- a/source/static/templates/plain_text.html +++ /dev/null @@ -1,5 +0,0 @@ -## plain_text.html -<%inherit file="base.html"/> -<div class="left inner"> - <h1><i>${article_title}</i> from <a href="/articles/%s">${feed_title}</a></h1><br /> - ${description}
\ No newline at end of file |