|
|
@ -116,7 +116,7 @@
|
|
|
|
;; and files without extension that correspond to p files
|
|
|
|
;; and files without extension that correspond to p files
|
|
|
|
[(needs-template? path) (render-with-template path #:force force)]
|
|
|
|
[(needs-template? path) (render-with-template path #:force force)]
|
|
|
|
;; this will catch ptree files
|
|
|
|
;; this will catch ptree files
|
|
|
|
[(ptree-source? path) (let ([ptree (dynamic-require path 'main)])
|
|
|
|
[(report (ptree-source? path)) (let ([ptree (dynamic-require path 'main)])
|
|
|
|
(render-files-in-ptree ptree #:force force))]
|
|
|
|
(render-files-in-ptree ptree #:force force))]
|
|
|
|
[(equal? FALLBACK_TEMPLATE (->string (file-name-from-path path)))
|
|
|
|
[(equal? FALLBACK_TEMPLATE (->string (file-name-from-path path)))
|
|
|
|
(message "Render: using fallback template")]
|
|
|
|
(message "Render: using fallback template")]
|
|
|
@ -345,7 +345,8 @@
|
|
|
|
;; Therefore no way to arbitrarily invoke template at run-time.
|
|
|
|
;; Therefore no way to arbitrarily invoke template at run-time.
|
|
|
|
;; This routine creates a new namespace and compiles the template within it.
|
|
|
|
;; This routine creates a new namespace and compiles the template within it.
|
|
|
|
|
|
|
|
|
|
|
|
(define string-to-eval
|
|
|
|
(render-through-eval
|
|
|
|
|
|
|
|
source-dir
|
|
|
|
`(begin
|
|
|
|
`(begin
|
|
|
|
;; for include-template (used below)
|
|
|
|
;; for include-template (used below)
|
|
|
|
(require web-server/templates)
|
|
|
|
(require web-server/templates)
|
|
|
@ -355,16 +356,14 @@
|
|
|
|
(require ,(->string source-name))
|
|
|
|
(require ,(->string source-name))
|
|
|
|
(parameterize ([current-ptree (make-project-ptree ,PROJECT_ROOT)]
|
|
|
|
(parameterize ([current-ptree (make-project-ptree ,PROJECT_ROOT)]
|
|
|
|
[current-url-context ,PROJECT_ROOT])
|
|
|
|
[current-url-context ,PROJECT_ROOT])
|
|
|
|
(include-template #:command-char ,TEMPLATE_FIELD_DELIMITER ,(->string template-name)))))
|
|
|
|
(include-template #:command-char ,TEMPLATE_FIELD_DELIMITER ,(->string template-name))))))
|
|
|
|
|
|
|
|
|
|
|
|
(render-through-eval source-dir string-to-eval))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; render files listed in a ptree file
|
|
|
|
;; render files listed in a ptree file
|
|
|
|
(define/contract (render-files-in-ptree ptree #:force [force #f])
|
|
|
|
(define/contract (render-files-in-ptree ptree #:force [force #f])
|
|
|
|
((ptree?) (#:force boolean?) . ->* . void?)
|
|
|
|
((ptree?) (#:force boolean?) . ->* . void?)
|
|
|
|
;; pass force parameter through
|
|
|
|
;; pass force parameter through
|
|
|
|
(for-each (λ(i) (render i #:force force))
|
|
|
|
(for-each (λ(i) (render (report i) #:force force))
|
|
|
|
;; use dynamic-require to avoid requiring ptree.rkt every time render.rkt is required
|
|
|
|
;; use dynamic-require to avoid requiring ptree.rkt every time render.rkt is required
|
|
|
|
((dynamic-require "ptree.rkt" 'all-pages) ptree)))
|
|
|
|
((dynamic-require "ptree.rkt" 'all-pages) ptree)))
|
|
|
|
|
|
|
|
|
|
|
|