|
|
@ -201,14 +201,16 @@
|
|
|
|
(define template-path (or maybe-template-path (get-template-for source-path output-path)))
|
|
|
|
(define template-path (or maybe-template-path (get-template-for source-path output-path)))
|
|
|
|
|
|
|
|
|
|
|
|
;; output-path and template-path may not have an extension, so check them in order with fallback
|
|
|
|
;; output-path and template-path may not have an extension, so check them in order with fallback
|
|
|
|
(message (format "rendering /~a"
|
|
|
|
|
|
|
|
(find-relative-path (current-project-root) source-path)))
|
|
|
|
|
|
|
|
(match-define-values ((cons render-result _) _ real _)
|
|
|
|
(match-define-values ((cons render-result _) _ real _)
|
|
|
|
(parameterize ([current-directory (->complete-path (dirname source-path))]
|
|
|
|
(parameterize ([current-directory (->complete-path (dirname source-path))]
|
|
|
|
[current-poly-target (->symbol (or (get-ext output-path)
|
|
|
|
[current-poly-target (->symbol (or (get-ext output-path)
|
|
|
|
(and template-path (get-ext template-path))
|
|
|
|
(and template-path (get-ext template-path))
|
|
|
|
(current-poly-target)))]
|
|
|
|
(current-poly-target)))]
|
|
|
|
[current-render-source source-path])
|
|
|
|
[current-render-source source-path])
|
|
|
|
|
|
|
|
(message (format "rendering /~a~a"
|
|
|
|
|
|
|
|
(find-relative-path (current-project-root) source-path)
|
|
|
|
|
|
|
|
(if (has-inner-poly-ext? source-path) (format " as ~a" (current-poly-target)) "")))
|
|
|
|
(time-apply render-proc (list source-path template-path output-path))))
|
|
|
|
(time-apply render-proc (list source-path template-path output-path))))
|
|
|
|
;; wait till last possible moment to store mod dates, because render-proc may also trigger its own subrenders
|
|
|
|
;; wait till last possible moment to store mod dates, because render-proc may also trigger its own subrenders
|
|
|
|
;; e.g., of a template.
|
|
|
|
;; e.g., of a template.
|
|
|
@ -258,7 +260,7 @@
|
|
|
|
(raise-argument-error 'render-markup-or-markdown-source "valid output path" output-path))
|
|
|
|
(raise-argument-error 'render-markup-or-markdown-source "valid output path" output-path))
|
|
|
|
(define template-path (or maybe-template-path (get-template-for source-path output-path)))
|
|
|
|
(define template-path (or maybe-template-path (get-template-for source-path output-path)))
|
|
|
|
(unless template-path
|
|
|
|
(unless template-path
|
|
|
|
(raise-argument-error 'render-markup-or-markdown-source "valid template path" template-path))
|
|
|
|
(raise-argument-error 'render-markup-or-markdown-source (format "valid template path~a" (if (has-inner-poly-ext? source-path) (format " for target ~a" (current-poly-target)) "")) template-path))
|
|
|
|
(render-from-source-or-output-path template-path) ; because template might have its own preprocessor source
|
|
|
|
(render-from-source-or-output-path template-path) ; because template might have its own preprocessor source
|
|
|
|
(parameterize ([current-output-port (current-error-port)]
|
|
|
|
(parameterize ([current-output-port (current-error-port)]
|
|
|
|
[current-namespace (make-base-namespace)])
|
|
|
|
[current-namespace (make-base-namespace)])
|
|
|
|