more nits

pull/169/head
Matthew Butterick 6 years ago
parent fc3232303d
commit 29ea34d123

@ -1 +1 @@
1518765983 1518792093

@ -235,15 +235,15 @@
pollen/pagetree pollen/pagetree
pollen/core) pollen/core)
DIRECTORY-REQUIRE-FILES DIRECTORY-REQUIRE-FILES
(parameterize ([current-pagetree (make-project-pagetree CPR)]) (parameterize ([current-pagetree (make-project-pagetree CPR)]
(define DOC-ID (cached-doc SOURCE-PATH-STRING)) [current-metas (cached-metas SOURCE-PATH-STRING)])
(define META-ID (cached-metas SOURCE-PATH-STRING))
(local-require pollen/template pollen/top) (local-require pollen/template pollen/top)
(define DOC-ID (cached-doc SOURCE-PATH-STRING))
(define META-ID (current-metas))
(define here (path->pagenode (or (select-from-metas 'HERE-PATH-KEY META-ID) 'unknown))) (define here (path->pagenode (or (select-from-metas 'HERE-PATH-KEY META-ID) 'unknown)))
(parameterize ([current-metas META-ID]) (if (bytes? DOC-ID) ; if main export is binary, just pass it through
(if (bytes? DOC-ID) ; if main export is binary, just pass it through DOC-ID
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 ;; set current-directory because include-template wants to work relative to source location
(time (parameterize ([current-directory (->complete-path (dirname source-path))]) (time (parameterize ([current-directory (->complete-path (dirname source-path))])
(render-through-eval expr-to-eval)))) (render-through-eval expr-to-eval))))

@ -148,9 +148,10 @@ Note that if @racket[_meta-source] is a relative path or pagenode, it is treated
@section[#:tag "core"]{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. @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.
@racket[(current-metas)] will also work in templates, holding the @racket[metas] of the source currently being rendered into the template. @racket[(current-metas)] will also work in templates, holding the @racket[metas] of the source currently being rendered into the template.
Note that the default value is @racket[#f]. This indicates that no metas value is available. It is up to you to code your tag functions to do something sensible if this circumstance arises.} Note that the default value is @racket[#f]. This indicates that no metas value is available. It is up to you to code your tag functions to do something sensible if this circumstance arises.

Loading…
Cancel
Save