improving render

pull/9/head
Matthew Butterick 11 years ago
parent cd614ce11e
commit 9a5d336c4c

@ -19,8 +19,8 @@ clone copies rendered files to desktop
(displayln (format "Rendering ~a" dir-or-path)) (displayln (format "Rendering ~a" dir-or-path))
(list dir-or-path)) (list dir-or-path))
(begin (begin
(displayln (format "Rendering preproc & pagetree files in directory ~a" dir-or-path) (displayln (format "Rendering preproc & pagetree files in directory ~a" dir-or-path))
(apply append (map (λ(proc) (filter proc (directory-list dir-or-path))) (list preproc-source? pagetree-source?))))))))))) (apply append (map (λ(proc) (filter proc (directory-list dir-or-path))) (list preproc-source? pagetree-source?))))))))))
(define (handle-start directory [port #f]) (define (handle-start directory [port #f])
@ -45,7 +45,7 @@ clone copies rendered files to desktop
[("render") `(begin [("render") `(begin
;; todo: take extensions off the comand line ;; todo: take extensions off the comand line
(displayln "Render preproc & pagetree files ...") (displayln "Render preproc & pagetree files ...")
(require "render.rkt" "file-tools.rkt" "world.rkt") (require "render.rkt" "file.rkt" "world.rkt")
(apply render-batch (append-map project-files-with-ext (list world:preproc-source-ext world:pagetree-source-ext))))] (apply render-batch (append-map project-files-with-ext (list world:preproc-source-ext world:pagetree-source-ext))))]
[("clone") (let ([target-path [("clone") (let ([target-path
(if (> (len args) 1) (if (> (len args) 1)

@ -7,7 +7,7 @@
(define-for-syntax arg-command-name (with-handlers ([exn:fail? (λ(exn) #f)]) (vector-ref args 0))) (define-for-syntax arg-command-name (with-handlers ([exn:fail? (λ(exn) #f)]) (vector-ref args 0)))
(define-for-syntax arg-project-directory (define-for-syntax first-arg-or-current-dir
(with-handlers ([exn:fail? (λ(exn) (current-directory))]) (with-handlers ([exn:fail? (λ(exn) (current-directory))])
(path->complete-path (simplify-path (string->path (vector-ref args 1)))))) (path->complete-path (simplify-path (string->path (vector-ref args 1))))))
@ -24,8 +24,8 @@
(datum->syntax stx (datum->syntax stx
(case arg-command-name (case arg-command-name
[(#f "help") (handle-help)] [(#f "help") (handle-help)]
[("start") (handle-start arg-project-directory arg-server-port)] [("start") (handle-start first-arg-or-current-dir arg-server-port)]
[("render") (handle-render (vector-ref args 1))] [("render") (handle-render first-arg-or-current-dir)]
[else (handle-else arg-command-name)]))) [else (handle-else arg-command-name)])))
(select-syntax-for-command) (select-syntax-for-command)

@ -48,7 +48,7 @@
(reset-modification-dates) (reset-modification-dates)
(for-each (λ(x) ((if (pagetree-source? x) (for-each (λ(x) ((if (pagetree-source? x)
render-pagetree render-pagetree
render-to-file-if-needed) x)) xs)) render-from-source-or-output-path) x)) xs))
(define/contract+provide (render-pagetree pagetree-or-path) (define/contract+provide (render-pagetree pagetree-or-path)

Loading…
Cancel
Save