[22336] | 1 | (use hyde hyde-atom environments regex) |
---|
[21339] | 2 | (require-library regex) |
---|
| 3 | (import irregex) |
---|
[19902] | 4 | |
---|
[20905] | 5 | (define-hyde-environment live |
---|
| 6 | (clean-before-build #f) |
---|
| 7 | (output-dir "/var/www/spiffy/gazette")) |
---|
| 8 | |
---|
[20909] | 9 | (default-page-vars '(((: bos "issues/" (+ any) ".wiki") |
---|
[20447] | 10 | (layouts "article.sxml" "default.sxml")))) |
---|
| 11 | |
---|
[21348] | 12 | (link-shortcuts '((user . "http://wiki.call-cc.org/users/~A") |
---|
| 13 | (egg . "http://wiki.call-cc.org/egg/~A") |
---|
| 14 | (wiki . "http://wiki.call-cc.org/~A") |
---|
[21944] | 15 | (ticket . "http://bugs.call-cc.org/ticket/~A") |
---|
[21348] | 16 | (manual . "http://wiki.call-cc.org/manual/~A"))) |
---|
[21339] | 17 | |
---|
[19902] | 18 | (define $ (environment-ref (page-eval-env) '$)) |
---|
| 19 | |
---|
| 20 | (define (page-updated page) |
---|
| 21 | (or ($ 'updated page) ($ 'date page))) |
---|
| 22 | |
---|
| 23 | (define (sort-by pages accessor) |
---|
| 24 | (sort pages (lambda (p1 p2) (> (accessor p1) (accessor p2))))) |
---|
| 25 | |
---|
| 26 | (define (pages-matching regex) |
---|
[21339] | 27 | (map cdr (filter (lambda (p) (irregex-match regex (car p))) |
---|
[21475] | 28 | ((environment-ref (page-eval-env) 'pages))))) |
---|
[19902] | 29 | |
---|
[20060] | 30 | (define (format-seconds seconds) |
---|
[20065] | 31 | (time->string (seconds->utc-time seconds) "%Y-%m-%d %z")) |
---|
[20060] | 32 | |
---|
[20543] | 33 | (define (authors->sxml authors) |
---|
| 34 | `(,(car authors) |
---|
| 35 | ,@(if (null? (cdr authors)) |
---|
| 36 | '() |
---|
| 37 | (map (lambda (author) |
---|
| 38 | `(,(car author) (span (@ (class "author")) ,(cdr author)))) |
---|
| 39 | (append (map (cut cons ", " <>) (butlast (cdr authors))) |
---|
| 40 | `((" and " . ,(last authors)))))))) |
---|
| 41 | |
---|
[19902] | 42 | (for-each (lambda (binding) |
---|
| 43 | (apply environment-extend! (cons (page-eval-env) binding))) |
---|
| 44 | `((page-updated ,page-updated) |
---|
[20060] | 45 | (format-seconds ,format-seconds) |
---|
[20543] | 46 | (authors->sxml ,authors->sxml) |
---|
[20061] | 47 | (all-issues ,(lambda () |
---|
[22336] | 48 | (sort-by (pages-matching '(: "issues/" (+ num) ".wiki")) page-updated))))) |
---|