pull/169/head
Matthew Butterick 7 years ago
parent 8495bc0309
commit fc3232303d

@ -1 +1 @@
1518738938 1518765983

@ -235,17 +235,17 @@
pollen/pagetree pollen/pagetree
pollen/core) pollen/core)
DIRECTORY-REQUIRE-FILES DIRECTORY-REQUIRE-FILES
(parameterize ([current-pagetree (make-project-pagetree CPR)])
(define DOC-ID (cached-doc SOURCE-PATH-STRING)) (define DOC-ID (cached-doc SOURCE-PATH-STRING))
(define META-ID (cached-metas SOURCE-PATH-STRING)) (define META-ID (cached-metas SOURCE-PATH-STRING))
(parameterize ([current-pagetree (make-project-pagetree CPR)]
[current-metas META-ID])
(local-require pollen/template pollen/top) (local-require pollen/template pollen/top)
(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))))

@ -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) (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. @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.

Loading…
Cancel
Save