|
|
@ -409,13 +409,7 @@
|
|
|
|
[(->output-path source-path)]
|
|
|
|
[(->output-path source-path)]
|
|
|
|
[else #false]))
|
|
|
|
[else #false]))
|
|
|
|
(define key (template-cache-key source-path output-path))
|
|
|
|
(define key (template-cache-key source-path output-path))
|
|
|
|
(hash-ref! ram-cache
|
|
|
|
(define (cache-thunk)
|
|
|
|
;; within a session, this will prevent repeat players like "template.html.p"
|
|
|
|
|
|
|
|
;; from hitting the file cache repeatedly
|
|
|
|
|
|
|
|
key
|
|
|
|
|
|
|
|
(λ ()
|
|
|
|
|
|
|
|
(cache-ref! key
|
|
|
|
|
|
|
|
(λ ()
|
|
|
|
|
|
|
|
(match source-path
|
|
|
|
(match source-path
|
|
|
|
[(or (? markup-source?) (? markdown-source?))
|
|
|
|
[(or (? markup-source?) (? markdown-source?))
|
|
|
|
;; output-path may not have an extension
|
|
|
|
;; output-path may not have an extension
|
|
|
@ -427,7 +421,14 @@
|
|
|
|
get-default-template
|
|
|
|
get-default-template
|
|
|
|
get-fallback-template)])
|
|
|
|
get-fallback-template)])
|
|
|
|
(file-exists-or-has-source? (proc source-path output-path-ext)))]
|
|
|
|
(file-exists-or-has-source? (proc source-path output-path-ext)))]
|
|
|
|
[_ #false]))))))
|
|
|
|
[_ #false]))
|
|
|
|
|
|
|
|
(if (current-session-interactive?)
|
|
|
|
|
|
|
|
;; don't cache templates in interactive session, for fresher reloads
|
|
|
|
|
|
|
|
;; this makes it possible to add template and have it show up in next render
|
|
|
|
|
|
|
|
(cache-thunk)
|
|
|
|
|
|
|
|
;; otherwise, within a rendering session, this will prevent repeat players like "template.html.p"
|
|
|
|
|
|
|
|
;; from hitting the file cache repeatedly
|
|
|
|
|
|
|
|
(hash-ref! ram-cache key (λ () (cache-ref! key cache-thunk)))))
|
|
|
|
|
|
|
|
|
|
|
|
(module-test-external
|
|
|
|
(module-test-external
|
|
|
|
(require pollen/setup sugar/file sugar/coerce)
|
|
|
|
(require pollen/setup sugar/file sugar/coerce)
|
|
|
|