source: project/gazette/hyde.scm @ 20065

Last change on this file since 20065 was 20065, checked in by Moritz Heidkamp, 10 years ago

gazette: use tz offset instead of name

File size: 745 bytes
Line 
1(use hyde hyde-atom environments)
2
3(define $ (environment-ref (page-eval-env) '$))
4
5(define (page-updated page)
6  (or ($ 'updated page) ($ 'date page)))
7
8(define (sort-by pages accessor)
9  (sort pages (lambda (p1 p2) (> (accessor p1) (accessor p2)))))
10
11(define (pages-matching regex)
12  (map cdr (filter (lambda (p) (string-match regex (car p)))
13                   (environment-ref (page-eval-env) 'pages))))
14
15(define (format-seconds seconds)
16  (time->string (seconds->utc-time seconds) "%Y-%m-%d %z"))
17
18(for-each (lambda (binding)
19            (apply environment-extend! (cons (page-eval-env) binding)))
20          `((page-updated ,page-updated)
21            (format-seconds ,format-seconds)
22            (all-issues ,(lambda () 
23                           (sort-by (pages-matching "issues/.+") page-updated)))))
Note: See TracBrowser for help on using the repository browser.