source: project/gazette/hyde.scm @ 20447

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

gazette: use new extended default-page-vars functionality to set the issues' layouts

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