changeset 292:644ba9f3ffd2

Added --recent-dates-first + --recent-tags-first
author Steve Kemp <steve@steve.org.uk>
date Tue, 09 Dec 2008 18:58:14 +0000
parents 7dd1318c8652
children e2a71248ae72
files bin/chronicle
diffstat 1 files changed, 29 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/bin/chronicle	Tue Dec 09 18:05:55 2008 +0000
+++ b/bin/chronicle	Tue Dec 09 18:58:14 2008 +0000
@@ -30,6 +30,11 @@
    --pre-build   Specify a command to execute prior to building the blog.
    --post-build  Specify a command to execute once the blog has been built.
 
+  Sorting Options:
+
+   --recent-dates-first  Show recent entries first in the archive view.
+   --recent-tags-first   Show recent entries first in the tag view.
+
   Optional Features:
 
    --force        Force the copying of static files from the blog theme.
@@ -548,6 +553,10 @@
             "lower-case",     \$CONFIG{ 'lower-case' },
             "comment-days=s", \$CONFIG{ 'comment-days' },
 
+            # sorting
+            "recent-tags-first", \$CONFIG{'recent-tags-first'},
+            "recent-dates-first", \$CONFIG{'recent-dates-first'},
+
             # input format.
             "format=s",  \$CONFIG{ 'format' },
             "charset=s", \$CONFIG{ 'charset' },
@@ -1049,7 +1058,16 @@
     #
     #  Sort the entries by date
     #
-    my @sortedEntries = reverse sort bywhen @$entries;
+    my @sortedEntries;
+
+    if ( $CONFIG{'recent-tags-first'} )
+    {
+        @sortedEntries = sort bywhen @$entries;
+    }
+    else
+    {
+        @sortedEntries = reverse sort bywhen @$entries;
+    }
 
     #
     #  Now write the output as a HTML page.
@@ -1198,7 +1216,16 @@
     #
     #  Sort the entries by date
     #
-    my @sortedEntries = reverse sort bywhen @$entries;
+    my @sortedEntries;
+    if ( $CONFIG{'recent-dates-first'} )
+    {
+        @sortedEntries = sort bywhen @$entries;
+    }
+    else
+    {
+        @sortedEntries = reverse sort bywhen @$entries;
+    }
+
 
     #
     #  Now write the output as a HTML page.