make behavior of `omitted-path?` and `extra-path?` more consistent

pull/218/head
Matthew Butterick 5 years ago
parent c8a2aeb32f
commit 749feb460a

@ -118,30 +118,32 @@ version print the version" (current-server-port) (make-publish-di
#:when (directory-exists? dir) #:when (directory-exists? dir)
(define top-dir (very-nice-path dir)) (define top-dir (very-nice-path dir))
(let render-one-dir ([dir top-dir]) (let render-one-dir ([dir top-dir])
(parameterize ([current-directory dir] (when (or (extra-path? dir) (not (omitted-path? dir)))
[current-project-root (case (render-with-subdirs?) (parameterize ([current-directory dir]
[(recursive) dir] [current-project-root (case (render-with-subdirs?)
[else top-dir])]) [(recursive) dir]
(define dirlist (directory-list dir)) [else top-dir])])
(define preprocs (filter preproc-source? dirlist)) (define dirlist (directory-list dir))
(define static-pagetrees (filter pagetree-source? dirlist)) (define preprocs (filter preproc-source? dirlist))
;; if there are no static pagetrees, use make-project-pagetree (define static-pagetrees (filter pagetree-source? dirlist))
;; (which will synthesize a pagetree if needed, which includes all sources) ;; if there are no static pagetrees, use make-project-pagetree
(define batch-to-render ;; (which will synthesize a pagetree if needed, which includes all sources)
(map very-nice-path (define paths-to-render
(match static-pagetrees (map very-nice-path
[(? null?) (match static-pagetrees
(message (format "rendering generated pagetree for directory ~a" dir)) [(? null?)
(cdr (make-project-pagetree dir))] (message (format "rendering generated pagetree for directory ~a" dir))
[_ (cdr (make-project-pagetree dir))]
(message (format "rendering preproc & pagetree files in directory ~a" dir)) [_
(append preprocs static-pagetrees)]))) (message (format "rendering preproc & pagetree files in directory ~a" dir))
(apply render-batch batch-to-render #:parallel (render-parallel?)) (append preprocs static-pagetrees)])))
(when (render-with-subdirs?) (apply render-batch (for/list ([path paths-to-render]
(for ([path (in-list dirlist)] #:when (or (extra-path? path) (not (omitted-path? path))))
#:when (and (directory-exists? path) path) #:parallel (render-parallel?))
(not (omitted-path? path)))) (when (render-with-subdirs?)
(render-one-dir (->complete-path path))))))] (for ([path (in-list dirlist)]
#:when (directory-exists? path))
(render-one-dir (->complete-path path)))))))]
[path-args ;; path mode [path-args ;; path mode
(message (format "rendering ~a" (string-join (map ->string path-args) " "))) (message (format "rendering ~a" (string-join (map ->string path-args) " ")))
(apply render-batch (map very-nice-path path-args) #:parallel (render-parallel?))])))) (apply render-batch (map very-nice-path path-args) #:parallel (render-parallel?))]))))

@ -1 +1 @@
1562556705 1563325512

Loading…
Cancel
Save