From 6571959b6ea15e6d1fb954ca0c8d0f93830a9562 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Tue, 30 Oct 2018 20:37:49 -0700 Subject: [PATCH] Revert "workaround" This reverts commit 894ace3dbac08a1bf59a3691fe496a34583f99e5. --- pollen/cache.rkt | 7 +++---- pollen/private/cache-utils.rkt | 9 ++++----- pollen/render.rkt | 11 +++++------ 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/pollen/cache.rkt b/pollen/cache.rkt index 46f7ee4..1bacd69 100644 --- a/pollen/cache.rkt +++ b/pollen/cache.rkt @@ -47,11 +47,10 @@ (define ram-cache-record (hash-ref! ram-cache key get-cache-record)) (hash-ref ram-cache-record subkey)] [else - (define outer-ns (namespace-anchor->namespace cache-module-ns)) - (define new-ns (make-base-namespace)) - (namespace-attach-module outer-ns 'pollen/setup new-ns) - (parameterize ([current-namespace new-ns]) + (parameterize ([current-namespace (make-base-namespace)]) ;; brings in currently instantiated params (unlike namespace-require) + (define outer-ns (namespace-anchor->namespace cache-module-ns)) + (namespace-attach-module outer-ns 'pollen/setup) (dynamic-require path subkey))])))) (define+provide (cached-require path-string subkey) diff --git a/pollen/private/cache-utils.rkt b/pollen/private/cache-utils.rkt index 3118c99..19e4398 100644 --- a/pollen/private/cache-utils.rkt +++ b/pollen/private/cache-utils.rkt @@ -59,12 +59,11 @@ ;; the benefit of not reloading doc when you just need metas. ;; new namespace forces `dynamic-require` to re-instantiate `path` ;; otherwise it gets cached in current namespace. - ;; brings in currently instantiated params (unlike namespace-require) - (define outer-ns (namespace-anchor->namespace cache-utils-module-ns)) - (define new-ns (make-base-namespace)) - (namespace-attach-module outer-ns 'pollen/setup new-ns) - (parameterize ([current-namespace new-ns] + (parameterize ([current-namespace (make-base-namespace)] [current-directory (dirname path)]) + ;; brings in currently instantiated params (unlike namespace-require) + (define outer-ns (namespace-anchor->namespace cache-utils-module-ns)) + (namespace-attach-module outer-ns 'pollen/setup) (define doc-missing-thunk (λ () "")) (define metas-missing-thunk (λ () (hasheq))) (list doc-key (dynamic-require path doc-key doc-missing-thunk) diff --git a/pollen/render.rkt b/pollen/render.rkt index 2d7f260..434f812 100644 --- a/pollen/render.rkt +++ b/pollen/render.rkt @@ -147,7 +147,7 @@ (define template-path (or maybe-template-path (get-template-for source-path output-path))) ;; output-path and template-path may not have an extension, so check them in order with fallback - (message (format "rendering /~a" + (message (format "rendering /~a" (find-relative-path (current-project-root) source-path))) (match-define-values ((cons render-result _) _ real _) (parameterize ([current-poly-target (->symbol (or (get-ext output-path) @@ -175,12 +175,11 @@ (local-require scribble/core scribble/manual (prefix-in scribble- scribble/render)) (define source-dir (dirname source-path)) ;; make fresh namespace for scribble rendering (avoids dep/zo caching) - (define outer-ns (namespace-anchor->namespace render-module-ns)) - (define new-ns (make-base-namespace)) - (namespace-attach-module outer-ns 'scribble/core new-ns) - (namespace-attach-module outer-ns 'scribble/manual new-ns) - (parameterize ([current-namespace new-ns] + (parameterize ([current-namespace (make-base-namespace)] [current-directory (->complete-path source-dir)]) + (define outer-ns (namespace-anchor->namespace render-module-ns)) + (namespace-attach-module outer-ns 'scribble/core) + (namespace-attach-module outer-ns 'scribble/manual) ;; scribble/lp files have their doc export in a 'doc submodule, so check both locations (match (cond [(dynamic-require source-path 'doc (λ () #false))]