From 3043cc8bc44cc9d15c25eed2f86b28ebbd5a2858 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Tue, 19 Nov 2019 05:54:15 -0800 Subject: [PATCH] fix handling of poly files in project server (fixes #212) --- pollen/private/file-utils.rkt | 25 +++++++++---------------- pollen/private/ts.rktd | 2 +- pollen/render.rkt | 9 +++++---- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/pollen/private/file-utils.rkt b/pollen/private/file-utils.rkt index f037376..8e9f6ed 100644 --- a/pollen/private/file-utils.rkt +++ b/pollen/private/file-utils.rkt @@ -1,6 +1,6 @@ #lang racket/base (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) @@ -221,21 +221,14 @@ (define+provide (->source+output-paths source-or-output-path) ;(complete-path? . -> . (values complete-path? complete-path?)) ;; file-proc returns two values, but ormap only wants one - (define tests (list - has/is-null-source? - has/is-preproc-source? - has/is-markup-source? - has/is-scribble-source? - has/is-markdown-source?)) - (define file-procs (list ->null-source+output-paths - ->preproc-source+output-paths - ->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)) + (define file-proc + (match source-or-output-path + [(? has/is-null-source?) ->null-source+output-paths] + [(? has/is-preproc-source?) ->preproc-source+output-paths] + [(? has/is-markup-source?) ->markup-source+output-paths] + [(? has/is-scribble-source?) ->scribble-source+output-paths] + [(? has/is-markdown-source?) ->markdown-source+output-paths] + [_ (λ (x) (values #false #false))])) (file-proc source-or-output-path)) diff --git a/pollen/private/ts.rktd b/pollen/private/ts.rktd index a69b146..9223d48 100644 --- a/pollen/private/ts.rktd +++ b/pollen/private/ts.rktd @@ -1 +1 @@ -1573513757 +1574171655 diff --git a/pollen/render.rkt b/pollen/render.rkt index da16c50..81d1289 100644 --- a/pollen/render.rkt +++ b/pollen/render.rkt @@ -195,10 +195,11 @@ (define+provide/contract (render-from-source-or-output-path so-pathish) (pathish? . -> . void?) - (match (->complete-path so-pathish) - [(app ->source-path (and (not #false) source-path)) (render-to-file-if-needed source-path)] - [(? pagetree-source? pt) (render-pagenodes pt)] - [_ (void)])) + (define so-path (->complete-path so-pathish)) + (define-values (sp op) (->source+output-paths so-path)) + (cond + [(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))