matchify loop

pull/218/head
Matthew Butterick 5 years ago
parent 2cd655246c
commit 4583bce7b2

@ -1 +1 @@
1573245169 1573246118

@ -245,23 +245,15 @@
(define output-path (or maybe-output-path (->output-path source-path))) (define output-path (or maybe-output-path (->output-path source-path)))
(unless output-path (unless output-path
(raise-argument-error 'render "valid output path" output-path)) (raise-argument-error 'render "valid output path" output-path))
(define tests (list has/is-null-source? (define render-proc
has/is-preproc-source? (match source-path
has/is-markup-source? [(? has/is-null-source?) render-null-source]
has/is-scribble-source? [(? has/is-preproc-source?) render-preproc-source]
has/is-markdown-source?)) [(? has/is-markup-source?) render-markup-or-markdown-source]
(define render-procs (list render-null-source [(? has/is-scribble-source?) render-scribble-source]
render-preproc-source [(? has/is-markdown-source?) render-markup-or-markdown-source]
render-markup-or-markdown-source [_ (raise-argument-error 'render (format "valid rendering function for ~a" source-path) #false)]))
render-scribble-source
render-markup-or-markdown-source))
(define render-proc (for/first ([test (in-list tests)]
[render-proc (in-list render-procs)]
#:when (test source-path))
render-proc))
(unless render-proc
(raise-argument-error 'render (format "valid rendering function for ~a" source-path) render-proc))
(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)))

Loading…
Cancel
Save