From: David Bremner Date: Sun, 7 Sep 2008 20:29:40 +0000 (-0300) Subject: sort rootset by date X-Git-Tag: 0.4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ae01731bb869a922c0cffab1efe39efda51f7496;p=ikiwiki.git sort rootset by date --- diff --git a/IkiWiki/Plugin/mailbox.pm b/IkiWiki/Plugin/mailbox.pm index bf626030b..df77579f7 100644 --- a/IkiWiki/Plugin/mailbox.pm +++ b/IkiWiki/Plugin/mailbox.pm @@ -19,7 +19,7 @@ use Email::Thread; use CGI 'escapeHTML'; use File::Temp qw/tempfile/; use File::MimeInfo::Magic; - +use Date::Parse; my %metaheaders; @@ -82,7 +82,11 @@ sub format_mailbox(@){ $threader->thread(); - return join "\n", map { format_thread(%params,thread=>$_) } $threader->rootset; + my @roots= sort { str2time($a->header('Date')) <=> + str2time($b->header('Date'))} ($threader->rootset); + + return join "\n", map { format_thread(%params,thread=>$_) } @roots; + } sub format_thread(@){