Changeset 31336 in project


Ignore:
Timestamp:
09/05/14 22:31:15 (7 years ago)
Author:
Moritz Heidkamp
Message:

hyde: Add around-page-translate hook

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/hyde/trunk/hyde.scm

    r31331 r31336  
    2626 sxml-conversion-rules
    2727 ignore-page?
     28 around-page-translate
    2829 before-page-serve
    2930
     
    9697(define link-shortcuts (make-parameter '()))
    9798(define ignore-page? (make-parameter #f))
     99(define before-page-serve (make-parameter values))
     100(define around-page-translate (make-parameter (lambda (p c) (c))))
     101
    98102
    99103(define translators (make-parameter '()))
    100104(define current-page (make-parameter #f))
    101105(define pages (make-parameter '()))
    102 (define page-eval-env
    103   (make-parameter (make-page-eval-env)))
     106(define page-eval-env (make-parameter (make-page-eval-env)))
    104107
    105108(define-syntax define-hyde-environment
     
    259262                 headers: `((content-type ,(file-extension->mime-type
    260263                                            (pathname-extension (page-path page)))))))
    261 
    262 (define before-page-serve
    263   (make-parameter values))
    264264
    265265(define (serve)
     
    330330
    331331(define (wrap-with-layouts contents #!optional layouts)
    332   (let* ((layouts (or layouts (alist-ref 'layouts (page-vars (current-page))) (default-layouts))))
    333     (fold (cut wrap-with-layout <> <>)
    334           contents
    335           (map (cut make-pathname (layouts-dir) <>) layouts))))
     332  ((around-page-translate)
     333   (current-page)
     334   (lambda ()
     335     (let* ((layouts (or layouts (alist-ref 'layouts (page-vars (current-page))) (default-layouts))))
     336       (fold (cut wrap-with-layout <> <>)
     337             contents
     338             (map (cut make-pathname (layouts-dir) <>) layouts))))))
    336339
    337340(define (with-input-from-source-file source-file proc)
Note: See TracChangeset for help on using the changeset viewer.