diff options
-rw-r--r-- | src/atom.scm | 3 | ||||
-rw-r--r-- | src/dates.scm | 6 | ||||
-rw-r--r-- | src/html.scm | 11 |
3 files changed, 17 insertions, 3 deletions
diff --git a/src/atom.scm b/src/atom.scm index ca2a225..9f363f7 100644 --- a/src/atom.scm +++ b/src/atom.scm @@ -78,7 +78,8 @@ (find-newest (map entry-updated posts)) '())) (append-entry! (partial append-feed-entry! f))) - (for-each append-entry! posts) + (for-each append-entry! + (sort posts date>?)) f)) diff --git a/src/dates.scm b/src/dates.scm index 2bbb977..e9c9b0c 100644 --- a/src/dates.scm +++ b/src/dates.scm @@ -5,7 +5,8 @@ date->string/RFC3339 unix-date newest - find-newest)) + find-newest + date>?)) (define (string/ISO->date string) (string->date string "~Y-~m-~d")) @@ -17,4 +18,7 @@ (define (newest a b) (if (time>? (date->time-utc a) (date->time-utc b)) a b)) +(define (date>? a b) + (time>? (date->time-utc a) (date->time-utc b))) + (define (find-newest dates) (reduce newest unix-date dates)) diff --git a/src/html.scm b/src/html.scm index 707ef2f..a6bdd13 100644 --- a/src/html.scm +++ b/src/html.scm @@ -72,7 +72,16 @@ (styles '()) (scripts '()) #:allow-other-keys) - (make-index title short-description long-description uri atom-feed-uri author posts styles scripts)) + (make-index + title + short-description + long-description + uri + atom-feed-uri + author + (sort posts date>?) + styles + scripts)) (define* (post #:key (id #f) |