|
|
|
@ -178,16 +178,17 @@
|
|
|
|
|
(define expr-to-eval
|
|
|
|
|
`(begin
|
|
|
|
|
(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)
|
|
|
|
|
(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))]
|
|
|
|
|
[,(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)))
|
|
|
|
|
(cond
|
|
|
|
|
[(bytes? ,(world:current-main-export)) ,(world:current-main-export)] ; if main export is binary, just pass it through
|
|
|
|
|
[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
|
|
|
|
|
(render-through-eval expr-to-eval))))
|
|
|
|
|
|
|
|
|
@ -223,43 +224,8 @@
|
|
|
|
|
(> (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)
|
|
|
|
|
(list? . -> . (or/c string? bytes?))
|
|
|
|
|
(parameterize ([current-namespace (make-base-namespace)]
|
|
|
|
|
[current-output-port (current-error-port)]
|
|
|
|
|
[current-pagetree (make-project-pagetree (world:current-project-root))])
|
|
|
|
|
(apply copy-from-namespace caching-module-ns (current-namespace) cached-module-names)
|
|
|
|
|
(eval expr-to-eval (current-namespace))))
|
|
|
|
|
[current-output-port (current-error-port)])
|
|
|
|
|
(eval expr-to-eval)))
|