(use hyde hyde-atom environments regex) (require-library regex) (import irregex) (define-hyde-environment live (clean-before-build #f) (output-dir "/var/www/spiffy/gazette")) (default-page-vars '(((: bos "issues/" (+ any) ".wiki") (layouts "article.sxml" "default.sxml")))) (link-shortcuts '((user . "http://wiki.call-cc.org/users/~A") (egg . "http://wiki.call-cc.org/egg/~A") (wiki . "http://wiki.call-cc.org/~A") (ticket . "http://bugs.call-cc.org/ticket/~A") (manual . "http://wiki.call-cc.org/manual/~A"))) (define $ (environment-ref (page-eval-env) '$)) (define (page-updated page) (or ($ 'updated page) ($ 'date page))) (define (sort-by pages accessor) (sort pages (lambda (p1 p2) (> (accessor p1) (accessor p2))))) (define (pages-matching regex) (map cdr (filter (lambda (p) (irregex-match regex (car p))) ((environment-ref (page-eval-env) 'pages))))) (define (format-seconds seconds) (time->string (seconds->utc-time seconds) "%Y-%m-%d %z")) (define (authors->sxml authors) `(,(car authors) ,@(if (null? (cdr authors)) '() (map (lambda (author) `(,(car author) (span (@ (class "author")) ,(cdr author)))) (append (map (cut cons ", " <>) (butlast (cdr authors))) `((" and " . ,(last authors)))))))) (for-each (lambda (binding) (apply environment-extend! (cons (page-eval-env) binding))) `((page-updated ,page-updated) (format-seconds ,format-seconds) (authors->sxml ,authors->sxml) (all-issues ,(lambda () (sort-by (pages-matching '(: "issues/" (+ num) ".wiki")) page-updated)))))