From fc3232303d80403adbd81ef5c339f77a89fd8e27 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Thu, 15 Feb 2018 23:26:23 -0800 Subject: [PATCH] nits --- pollen/private/ts.rktd | 2 +- pollen/render.rkt | 28 ++++++++++++++-------------- pollen/scribblings/core.scrbl | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pollen/private/ts.rktd b/pollen/private/ts.rktd index 2f690f3..68c083b 100644 --- a/pollen/private/ts.rktd +++ b/pollen/private/ts.rktd @@ -1 +1 @@ -1518738938 +1518765983 diff --git a/pollen/render.rkt b/pollen/render.rkt index ae26ac3..d184d2a 100644 --- a/pollen/render.rkt +++ b/pollen/render.rkt @@ -77,7 +77,7 @@ has/is-markup-source? has/is-scribble-source? has/is-markdown-source?))]) - (pred so-path)) + (pred so-path)) (define-values (source-path output-path) (->source+output-paths so-path)) (render-to-file-if-needed source-path #f output-path)] [(pagetree-source? so-path) (render-pagenodes so-path)]) @@ -151,7 +151,7 @@ (define render-proc (for/first ([test (in-list tests)] [render-proc (in-list render-procs)] #:when (test source-path)) - render-proc)) + render-proc)) (unless render-proc (raise-argument-error 'render (format "valid rendering function for ~a" source-path) render-proc)) @@ -235,18 +235,18 @@ pollen/pagetree pollen/core) DIRECTORY-REQUIRE-FILES - (define DOC-ID (cached-doc SOURCE-PATH-STRING)) - (define META-ID (cached-metas SOURCE-PATH-STRING)) - (parameterize ([current-pagetree (make-project-pagetree CPR)] - [current-metas META-ID]) + (parameterize ([current-pagetree (make-project-pagetree CPR)]) + (define DOC-ID (cached-doc SOURCE-PATH-STRING)) + (define META-ID (cached-metas SOURCE-PATH-STRING)) (local-require pollen/template pollen/top) (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)))))))) -;; set current-directory because include-template wants to work relative to source location -(time (parameterize ([current-directory (->complete-path (dirname source-path))]) - (render-through-eval expr-to-eval)))) + (parameterize ([current-metas META-ID]) + (if (bytes? DOC-ID) ; if main export is binary, just pass it through + DOC-ID + (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 (dirname source-path))]) + (render-through-eval expr-to-eval)))) (define (templated-source? path) @@ -259,7 +259,7 @@ (define (file-exists-or-has-source? p) ; p could be #f (and p (for/first ([proc (in-list (list values ->preproc-source-path ->null-source-path))] #:when (file-exists? (proc p))) - p))) + p))) (define (get-template) (define output-path (or maybe-output-path (->output-path source-path))) @@ -318,4 +318,4 @@ (parameterize ([current-namespace (make-base-namespace)] [current-output-port (current-error-port)]) (namespace-attach-module (namespace-anchor->namespace render-module-ns) 'pollen/setup) ; brings in params - (eval expr-to-eval))) \ No newline at end of file + (eval expr-to-eval))) diff --git a/pollen/scribblings/core.scrbl b/pollen/scribblings/core.scrbl index 6b60347..402c8c0 100644 --- a/pollen/scribblings/core.scrbl +++ b/pollen/scribblings/core.scrbl @@ -146,7 +146,7 @@ Note that if @racket[_meta-source] is a relative path or pagenode, it is treated (select-from-metas 'nonexistent-key metas) ] -@section{Parameters} +@section[#:tag "core"]{Parameters} @defparam[current-metas hash (or/c #f hash?) #:value #f]{Holds the @racket[metas] of the current Pollen source. In tag functions, rather than pass @racket[metas] as an argument, you can refer to @racket[(current-metas)] within the body of the function. Likewise, if your tag function calls other tag functions, they can all invoke @racket[(current-metas)] instead of passing the value around.