From b819ba6f6e98f00fc17915bb504ccfcf1b9d3a80 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Mon, 7 Aug 2017 10:20:19 -0700 Subject: [PATCH] datumize --- pollen/render.rkt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pollen/render.rkt b/pollen/render.rkt index 921d1a0..7ba451b 100644 --- a/pollen/render.rkt +++ b/pollen/render.rkt @@ -185,8 +185,10 @@ (define (render-preproc-source source-path . _) (time (parameterize ([current-directory (->complete-path (dirname source-path))]) - (render-through-eval #`(begin (require pollen/cache) - (cached-doc #,source-path)))))) + (render-through-eval (syntax->datum + (with-syntax ([SOURCE-PATH source-path]) + #`(begin (require pollen/cache) + (cached-doc SOURCE-PATH)))))))) (define (render-markup-or-markdown-source source-path [maybe-template-path #f] [maybe-output-path #f]) @@ -198,8 +200,9 @@ (unless template-path (raise-argument-error 'render-markup-or-markdown-source "valid template path" template-path)) (render-from-source-or-output-path template-path) ; because template might have its own preprocessor source - (define stx-to-eval - (with-syntax ([DIRECTORY-REQUIRE-FILES (require-directory-require-files source-path)] + (define expr-to-eval + (syntax->datum + (with-syntax ([DIRECTORY-REQUIRE-FILES (require-directory-require-files source-path)] [DOC-ID (setup:main-export source-path)] [META-ID (setup:meta-export source-path)] [SOURCE-PATH-STRING (path->string source-path)] @@ -222,10 +225,10 @@ (define here (path->pagenode (or (select-from-metas 'HERE-PATH-KEY META-ID) 'unknown))) (if (bytes? DOC-ID) ; if main export is binary, just pass it through DOC-ID - (include-template #:command-char COMMAND-CHAR (file TEMPLATE-PATH))))))) + (include-template #:command-char COMMAND-CHAR (file TEMPLATE-PATH)))))))) ;; set current-directory because include-template wants to work relative to source location (time (parameterize ([current-directory (->complete-path source-dir)]) - (render-through-eval stx-to-eval)))) + (render-through-eval expr-to-eval)))) (define (templated-source? path)