aboutsummaryrefslogtreecommitdiffstats
path: root/nikola/plugins/task/archive.py
diff options
context:
space:
mode:
authorLibravatarDererk <dererk@satellogic.com>2016-11-15 14:18:53 -0300
committerLibravatarDererk <dererk@satellogic.com>2016-11-15 14:18:53 -0300
commit1ad5102b7ddd181bb9c632b124d3ea4c7db28be6 (patch)
tree73dda18465d0f4b8eb52d4482282a387c9f67c95 /nikola/plugins/task/archive.py
parentb67294f76809a681ff73f209ed691a3e3f00563d (diff)
parentffb671c61a24a9086343b54bad080e145ff33fc5 (diff)
Merge tag 'upstream/7.8.1'
Upstream version 7.8.1 # gpg: Firmado el mar 15 nov 2016 14:18:48 ART # gpg: usando RSA clave A6C7B88B9583046A11C5403E0B00FB6CEBE2D002 # gpg: Firma correcta de "Ulises Vitulli <dererk@debian.org>" [absoluta] # gpg: alias "Dererk <dererk@torproject.org>" [absoluta] # gpg: alias "Ulises Vitulli <uvitulli@fi.uba.ar>" [absoluta] # gpg: alias "Ulises Vitulli <dererk@satellogic.com>" [absoluta]
Diffstat (limited to 'nikola/plugins/task/archive.py')
-rw-r--r--nikola/plugins/task/archive.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/nikola/plugins/task/archive.py b/nikola/plugins/task/archive.py
index 126aed4..303d349 100644
--- a/nikola/plugins/task/archive.py
+++ b/nikola/plugins/task/archive.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2015 Roberto Alsina and others.
+# Copyright © 2012-2016 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -37,7 +37,6 @@ from nikola.utils import config_changed, adjust_name_for_index_path, adjust_name
class Archive(Task):
-
"""Render the post archives."""
name = "render_archive"
@@ -53,7 +52,7 @@ class Archive(Task):
"""Prepare an archive task."""
# name: used to build permalink and destination
# posts, items: posts or items; only one of them should be used,
- # the other be None
+ # the other should be None
# template_name: name of the template to use
# title: the (translated) title for the generated page
# deps_translatable: dependencies (None if not added)
@@ -175,10 +174,10 @@ class Archive(Task):
if not kw["create_monthly_archive"] or kw["create_full_archives"]:
yield self._generate_posts_task(kw, year, lang, posts, title, deps_translatable)
else:
- months = set([(m.split('/')[1], self.site.link("archive", m, lang)) for m in self.site.posts_per_month.keys() if m.startswith(str(year))])
+ months = set([(m.split('/')[1], self.site.link("archive", m, lang), len(self.site.posts_per_month[m])) for m in self.site.posts_per_month.keys() if m.startswith(str(year))])
months = sorted(list(months))
months.reverse()
- items = [[nikola.utils.LocaleBorg().get_month_name(int(month), lang), link] for month, link in months]
+ items = [[nikola.utils.LocaleBorg().get_month_name(int(month), lang), link, count] for month, link, count in months]
yield self._prepare_task(kw, year, lang, None, items, "list.tmpl", title, deps_translatable)
if not kw["create_monthly_archive"] and not kw["create_full_archives"] and not kw["create_daily_archive"]:
@@ -219,11 +218,16 @@ class Archive(Task):
years.sort(reverse=True)
kw['years'] = years
for lang in kw["translations"]:
- items = [(y, self.site.link("archive", y, lang)) for y in years]
+ items = [(y, self.site.link("archive", y, lang), len(self.site.posts_per_year[y])) for y in years]
yield self._prepare_task(kw, None, lang, None, items, "list.tmpl", kw["messages"][lang]["Archive"])
def archive_path(self, name, lang, is_feed=False):
- """Return archive paths."""
+ """Link to archive path, name is the year.
+
+ Example:
+
+ link://archive/2013 => /archives/2013/index.html
+ """
if is_feed:
extension = ".atom"
archive_file = os.path.splitext(self.site.config['ARCHIVE_FILENAME'])[0] + extension
@@ -241,5 +245,10 @@ class Archive(Task):
archive_file] if _f]
def archive_atom_path(self, name, lang):
- """Return Atom archive paths."""
+ """Link to atom archive path, name is the year.
+
+ Example:
+
+ link://archive_atom/2013 => /archives/2013/index.atom
+ """
return self.archive_path(name, lang, is_feed=True)