From 10dc5ef0b7d901d5718a35914ceae353ae87a903 Mon Sep 17 00:00:00 2001 From: Dane Knecht Date: Mon, 29 Apr 2013 20:57:05 -0700 Subject: [PATCH] sort author and category pages same way as tags --- pelican/generators.py | 2 + .../output/basic/author/alexis-metaireau.html | 78 ++++++------ .../custom/author/alexis-metaireau.html | 110 ++++++++--------- .../custom/author/alexis-metaireau2.html | 112 +++++++++--------- 4 files changed, 157 insertions(+), 145 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index 13909743..dea22e17 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -335,6 +335,7 @@ class ArticlesGenerator(Generator): """Generate category pages.""" category_template = self.get_template('category') for cat, articles in self.categories: + articles.sort(key=attrgetter('date'), reverse=True) dates = [article for article in self.dates if article in articles] write(cat.save_as, category_template, self.context, category=cat, articles=articles, dates=dates, @@ -345,6 +346,7 @@ class ArticlesGenerator(Generator): """Generate Author pages.""" author_template = self.get_template('author') for aut, articles in self.authors: + articles.sort(key=attrgetter('date'), reverse=True) dates = [article for article in self.dates if article in articles] write(aut.save_as, author_template, self.context, author=aut, articles=articles, dates=dates, diff --git a/pelican/tests/output/basic/author/alexis-metaireau.html b/pelican/tests/output/basic/author/alexis-metaireau.html index 04a89930..fc253c2c 100644 --- a/pelican/tests/output/basic/author/alexis-metaireau.html +++ b/pelican/tests/output/basic/author/alexis-metaireau.html @@ -26,37 +26,7 @@ -
-

Other articles

-
-
    - -
  1. -
    -

    This is a super article !

    -
    - -
    +

    This is a super article !

    Multi-line metadata should be supported -as well as inline markup.

    +

    Some content here !

    +
    +

    This is a simple title

    +

    And here comes the cool stuff.

    +alternate text +alternate text +
    +>>> from ipdb import set_trace
    +>>> set_trace()
    +
    +

    → And now try with some utf8 hell: ééé

    +
    +
    + +
    +

    Other articles

    +
    +
      - read more +
    1. +
      +

      Oh yeah !

      +
      + +
      +
      +

      Why not ?

      +

      After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! +YEAH !

      +alternate text +
      + + read more
    diff --git a/pelican/tests/output/custom/author/alexis-metaireau.html b/pelican/tests/output/custom/author/alexis-metaireau.html index e732fdcc..ded2e38d 100644 --- a/pelican/tests/output/custom/author/alexis-metaireau.html +++ b/pelican/tests/output/custom/author/alexis-metaireau.html @@ -30,7 +30,57 @@ +
    +

    Other articles

    +
    +
      + +
    1. + +
    2. - -
      -

      Other articles

      -
      -
        +a file-relative link to unbelievable

        + read more +

        There are comments.

        +
      1. - -
      2. - -

      Page 1 / 3 diff --git a/pelican/tests/output/custom/author/alexis-metaireau2.html b/pelican/tests/output/custom/author/alexis-metaireau2.html index d984d5e7..ceb6877c 100644 --- a/pelican/tests/output/custom/author/alexis-metaireau2.html +++ b/pelican/tests/output/custom/author/alexis-metaireau2.html @@ -32,25 +32,72 @@

      1. + +
      2. + +
      3. - -
      4. - -

      «