|
|
@ -64,7 +64,7 @@
|
|
|
|
((pathish?) (#:force boolean?) . ->* . void?)
|
|
|
|
((pathish?) (#:force boolean?) . ->* . void?)
|
|
|
|
(let ([so-path (->complete-path so-pathish)]) ; so-path = source or output path (could be either)
|
|
|
|
(let ([so-path (->complete-path so-pathish)]) ; so-path = source or output path (could be either)
|
|
|
|
(cond
|
|
|
|
(cond
|
|
|
|
[(ormap (λ(test) (test so-path)) (list has/is-null-source? has/is-preproc-source? has/is-markup-source? has/is-scribble-source? has/is-markdown-source?))
|
|
|
|
[(ormap (λ(test) (test so-path)) (list has/is-null-source? has/is-preproc-source? has/is-markup-source? has/is-scribble-source? has/is-markdown-source? has/is-template-source?))
|
|
|
|
(let-values ([(source-path output-path) (->source+output-paths so-path)])
|
|
|
|
(let-values ([(source-path output-path) (->source+output-paths so-path)])
|
|
|
|
(render-to-file-if-needed source-path output-path #:force force))]
|
|
|
|
(render-to-file-if-needed source-path output-path #:force force))]
|
|
|
|
[(pagetree-source? so-path) (render-pagetree so-path)]))
|
|
|
|
[(pagetree-source? so-path) (render-pagetree so-path)]))
|
|
|
@ -75,8 +75,8 @@
|
|
|
|
(complete-path? . -> . (values complete-path? complete-path?))
|
|
|
|
(complete-path? . -> . (values complete-path? complete-path?))
|
|
|
|
;; file-proc returns two values, but ormap only wants one
|
|
|
|
;; file-proc returns two values, but ormap only wants one
|
|
|
|
(define file-proc (ormap (λ(test file-proc) (and (test source-or-output-path) file-proc))
|
|
|
|
(define file-proc (ormap (λ(test file-proc) (and (test source-or-output-path) file-proc))
|
|
|
|
(list has/is-null-source? has/is-preproc-source? has/is-markup-source? has/is-scribble-source? has/is-markdown-source?)
|
|
|
|
(list has/is-null-source? has/is-preproc-source? has/is-markup-source? has/is-scribble-source? has/is-markdown-source? has/is-template-source?)
|
|
|
|
(list ->null-source+output-paths ->preproc-source+output-paths ->markup-source+output-paths ->scribble-source+output-paths ->markdown-source+output-paths)))
|
|
|
|
(list ->null-source+output-paths ->preproc-source+output-paths ->markup-source+output-paths ->scribble-source+output-paths ->markdown-source+output-paths ->template-source+output-paths)))
|
|
|
|
(file-proc source-or-output-path))
|
|
|
|
(file-proc source-or-output-path))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -119,8 +119,8 @@
|
|
|
|
(define render-proc
|
|
|
|
(define render-proc
|
|
|
|
(cond
|
|
|
|
(cond
|
|
|
|
[(ormap (λ(test render-proc) (and (test source-path) render-proc))
|
|
|
|
[(ormap (λ(test render-proc) (and (test source-path) render-proc))
|
|
|
|
(list has/is-null-source? has/is-preproc-source? has/is-markup-source? has/is-scribble-source? has/is-markdown-source?)
|
|
|
|
(list has/is-null-source? has/is-preproc-source? has/is-markup-source? has/is-scribble-source? has/is-markdown-source? has/is-template-source?)
|
|
|
|
(list render-null-source render-preproc-source render-markup-or-markdown-source render-scribble-source render-markup-or-markdown-source))]
|
|
|
|
(list render-null-source render-preproc-source render-markup-or-markdown-source render-scribble-source render-markup-or-markdown-source render-preproc-source))]
|
|
|
|
[else (error (format "render: no rendering function found for ~a" source-path))]))
|
|
|
|
[else (error (format "render: no rendering function found for ~a" source-path))]))
|
|
|
|
|
|
|
|
|
|
|
|
(message (format "render: ~a" (file-name-from-path source-path)))
|
|
|
|
(message (format "render: ~a" (file-name-from-path source-path)))
|
|
|
@ -168,7 +168,7 @@
|
|
|
|
[metas (cached-require ,source-path ',world:meta-pollen-export)])
|
|
|
|
[metas (cached-require ,source-path ',world:meta-pollen-export)])
|
|
|
|
(local-require pollen/pagetree pollen/template pollen/top)
|
|
|
|
(local-require pollen/pagetree pollen/template pollen/top)
|
|
|
|
(define here (metas->here metas))
|
|
|
|
(define here (metas->here metas))
|
|
|
|
(include-template #:command-char ,world:template-field-delimiter ,(->string (find-relative-path source-dir template-path))))))
|
|
|
|
(include-template #:command-char ,world:command-marker ,(->string (find-relative-path source-dir template-path))))))
|
|
|
|
|
|
|
|
|
|
|
|
(time (parameterize ([current-directory source-dir]) ; because include-template wants to work relative to source location
|
|
|
|
(time (parameterize ([current-directory source-dir]) ; because include-template wants to work relative to source location
|
|
|
|
(render-through-eval expr-to-eval))))
|
|
|
|
(render-through-eval expr-to-eval))))
|
|
|
@ -183,8 +183,8 @@
|
|
|
|
(complete-path? . -> . (or/c #f complete-path?))
|
|
|
|
(complete-path? . -> . (or/c #f complete-path?))
|
|
|
|
(match-define-values (source-dir _ _) (split-path source-path))
|
|
|
|
(match-define-values (source-dir _ _) (split-path source-path))
|
|
|
|
(and (templated-source? source-path) ; doesn't make sense if it's not a templated source format
|
|
|
|
(and (templated-source? source-path) ; doesn't make sense if it's not a templated source format
|
|
|
|
(or ; Build the possible paths and use the first one that either exists, or has a preproc source that exists.
|
|
|
|
(or ; Build the possible paths and use the first one that either exists, or has existing source (template, preproc, or null)
|
|
|
|
(ormap (λ(p) (if (ormap file-exists? (list p (->preproc-source-path p))) p #f))
|
|
|
|
(ormap (λ(p) (if (ormap file-exists? (list p (->template-source-path p) (->preproc-source-path p) (->null-source-path p))) p #f))
|
|
|
|
(filter (λ(x) (->boolean x)) ; if any of the possibilities below are invalid, they return #f
|
|
|
|
(filter (λ(x) (->boolean x)) ; if any of the possibilities below are invalid, they return #f
|
|
|
|
(list
|
|
|
|
(list
|
|
|
|
(parameterize ([current-directory (world:current-project-root)])
|
|
|
|
(parameterize ([current-directory (world:current-project-root)])
|
|
|
@ -192,7 +192,7 @@
|
|
|
|
(and ((->symbol world:template-meta-key) . in? . source-metas)
|
|
|
|
(and ((->symbol world:template-meta-key) . in? . source-metas)
|
|
|
|
(build-path source-dir (get source-metas (->string world:template-meta-key)))))) ; path based on metas
|
|
|
|
(build-path source-dir (get source-metas (->string world:template-meta-key)))))) ; path based on metas
|
|
|
|
(build-path (world:current-project-root)
|
|
|
|
(build-path (world:current-project-root)
|
|
|
|
(add-ext (add-ext world:default-template-prefix (get-ext (->output-path source-path))) world:template-source-ext))))) ; path to default template
|
|
|
|
(add-ext world:default-template-prefix (get-ext (->output-path source-path))))))) ; path to default template
|
|
|
|
(build-path (world:current-server-extras-path) world:fallback-template)))) ; fallback template
|
|
|
|
(build-path (world:current-server-extras-path) world:fallback-template)))) ; fallback template
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|