|
|
@ -178,16 +178,17 @@
|
|
|
|
(define expr-to-eval
|
|
|
|
(define expr-to-eval
|
|
|
|
`(begin
|
|
|
|
`(begin
|
|
|
|
(require (for-syntax racket/base))
|
|
|
|
(require (for-syntax racket/base))
|
|
|
|
(require pollen/include-template pollen/cache pollen/debug)
|
|
|
|
(require pollen/include-template pollen/cache pollen/debug pollen/pagetree)
|
|
|
|
,(require-directory-require-files source-path)
|
|
|
|
,(require-directory-require-files source-path)
|
|
|
|
|
|
|
|
(parameterize ([current-pagetree (make-project-pagetree ,(world:current-project-root))])
|
|
|
|
(let ([,(world:current-main-export) (cached-require ,(path->string source-path) ',(world:current-main-export))]
|
|
|
|
(let ([,(world:current-main-export) (cached-require ,(path->string source-path) ',(world:current-main-export))]
|
|
|
|
[,(world:current-meta-export) (cached-require ,(path->string source-path) ',(world:current-meta-export))])
|
|
|
|
[,(world:current-meta-export) (cached-require ,(path->string source-path) ',(world:current-meta-export))])
|
|
|
|
(local-require pollen/pagetree pollen/template pollen/top)
|
|
|
|
(local-require pollen/template pollen/top)
|
|
|
|
(define here (metas->here ,(world:current-meta-export)))
|
|
|
|
(define here (metas->here ,(world:current-meta-export)))
|
|
|
|
(cond
|
|
|
|
(cond
|
|
|
|
[(bytes? ,(world:current-main-export)) ,(world:current-main-export)] ; if main export is binary, just pass it through
|
|
|
|
[(bytes? ,(world:current-main-export)) ,(world:current-main-export)] ; if main export is binary, just pass it through
|
|
|
|
[else
|
|
|
|
[else
|
|
|
|
(include-template #:command-char ,(world:current-command-char) (file ,(->string (find-relative-path source-dir template-path))))]))))
|
|
|
|
(include-template #:command-char ,(world:current-command-char) (file ,(->string (find-relative-path source-dir template-path))))])))))
|
|
|
|
(time (parameterize ([current-directory (->complete-path source-dir)]) ; because include-template wants to work relative to source location
|
|
|
|
(time (parameterize ([current-directory (->complete-path source-dir)]) ; because include-template wants to work relative to source location
|
|
|
|
(render-through-eval expr-to-eval))))
|
|
|
|
(render-through-eval expr-to-eval))))
|
|
|
|
|
|
|
|
|
|
|
@ -223,43 +224,8 @@
|
|
|
|
(> (length (dynamic-rerequire source-path)) 0)))
|
|
|
|
(> (length (dynamic-rerequire source-path)) 0)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; set up namespace for module caching
|
|
|
|
|
|
|
|
(define-caching-ns caching-module-ns)
|
|
|
|
|
|
|
|
(define cached-module-names '(xml
|
|
|
|
|
|
|
|
racket/bool
|
|
|
|
|
|
|
|
racket/class
|
|
|
|
|
|
|
|
racket/contract
|
|
|
|
|
|
|
|
racket/draw
|
|
|
|
|
|
|
|
racket/file
|
|
|
|
|
|
|
|
racket/format
|
|
|
|
|
|
|
|
racket/function
|
|
|
|
|
|
|
|
racket/port
|
|
|
|
|
|
|
|
racket/list
|
|
|
|
|
|
|
|
racket/match
|
|
|
|
|
|
|
|
racket/string
|
|
|
|
|
|
|
|
racket/syntax
|
|
|
|
|
|
|
|
pollen/cache
|
|
|
|
|
|
|
|
pollen/debug
|
|
|
|
|
|
|
|
pollen/decode
|
|
|
|
|
|
|
|
pollen/file
|
|
|
|
|
|
|
|
pollen/include-template
|
|
|
|
|
|
|
|
pollen/main
|
|
|
|
|
|
|
|
pollen/reader-base
|
|
|
|
|
|
|
|
pollen/pagetree
|
|
|
|
|
|
|
|
pollen/rerequire
|
|
|
|
|
|
|
|
pollen/tag
|
|
|
|
|
|
|
|
pollen/template
|
|
|
|
|
|
|
|
pollen/world
|
|
|
|
|
|
|
|
pollen/project
|
|
|
|
|
|
|
|
sugar
|
|
|
|
|
|
|
|
txexpr))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(apply load-in-namespace caching-module-ns cached-module-names)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define/contract (render-through-eval expr-to-eval)
|
|
|
|
(define/contract (render-through-eval expr-to-eval)
|
|
|
|
(list? . -> . (or/c string? bytes?))
|
|
|
|
(list? . -> . (or/c string? bytes?))
|
|
|
|
(parameterize ([current-namespace (make-base-namespace)]
|
|
|
|
(parameterize ([current-namespace (make-base-namespace)]
|
|
|
|
[current-output-port (current-error-port)]
|
|
|
|
[current-output-port (current-error-port)])
|
|
|
|
[current-pagetree (make-project-pagetree (world:current-project-root))])
|
|
|
|
(eval expr-to-eval)))
|
|
|
|
(apply copy-from-namespace caching-module-ns (current-namespace) cached-module-names)
|
|
|
|
|
|
|
|
(eval expr-to-eval (current-namespace))))
|
|
|
|
|