fix handling of poly files in project server (fixes #212)

pull/218/head
Matthew Butterick 5 years ago
parent 43c981d06c
commit 3043cc8bc4

@ -1,6 +1,6 @@
#lang racket/base #lang racket/base
(require (for-syntax racket/base racket/syntax)) (require (for-syntax racket/base racket/syntax))
(require racket/path) (require racket/path racket/match)
(require "../setup.rkt" sugar/define sugar/file sugar/coerce sugar/test) (require "../setup.rkt" sugar/define sugar/file sugar/coerce sugar/test)
@ -221,21 +221,14 @@
(define+provide (->source+output-paths source-or-output-path) (define+provide (->source+output-paths source-or-output-path)
;(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 tests (list (define file-proc
has/is-null-source? (match source-or-output-path
has/is-preproc-source? [(? has/is-null-source?) ->null-source+output-paths]
has/is-markup-source? [(? has/is-preproc-source?) ->preproc-source+output-paths]
has/is-scribble-source? [(? has/is-markup-source?) ->markup-source+output-paths]
has/is-markdown-source?)) [(? has/is-scribble-source?) ->scribble-source+output-paths]
(define file-procs (list ->null-source+output-paths [(? has/is-markdown-source?) ->markdown-source+output-paths]
->preproc-source+output-paths [_ (λ (x) (values #false #false))]))
->markup-source+output-paths
->scribble-source+output-paths
->markdown-source+output-paths))
(define file-proc (for/first ([test (in-list tests)]
[file-proc (in-list file-procs)]
#:when (test source-or-output-path))
file-proc))
(file-proc source-or-output-path)) (file-proc source-or-output-path))

@ -1 +1 @@
1573513757 1574171655

@ -195,10 +195,11 @@
(define+provide/contract (render-from-source-or-output-path so-pathish) (define+provide/contract (render-from-source-or-output-path so-pathish)
(pathish? . -> . void?) (pathish? . -> . void?)
(match (->complete-path so-pathish) (define so-path (->complete-path so-pathish))
[(app ->source-path (and (not #false) source-path)) (render-to-file-if-needed source-path)] (define-values (sp op) (->source+output-paths so-path))
[(? pagetree-source? pt) (render-pagenodes pt)] (cond
[_ (void)])) [(and sp op) (render-to-file-if-needed sp #false op)]
[(pagetree-source? so-path) (render-pagenodes so-path)]))
(define render-ram-cache (make-hash)) (define render-ram-cache (make-hash))

Loading…
Cancel
Save