Great advice. Thanks so much. So I've defined an arbitrary function:
(define (output-filename meta-source)
   (path->string
        (car (reverse (explode-path (string->path (select-from-metas 'here-path 
meta-source)))))))

Then I call it from within a tag function like so:
(output-filename (current-metas))

Just want to say thanks again. In hindsight, here are the words from the 
manual about (current-metas):
"Holds the metas of the current Pollen source. In tag functions, ..."

Have a good evening and I really appreciate your help and that of Mr. 
Butterick.

On Thursday, March 28, 2019 at 10:10:02 PM UTC-4, Sorawee Porncharoenwase 
wrote:
>
> Can we see your pollen.rkt? Anyhow, it’s very likely that you call 
> (current-metas) outside of tag functions. 
>
> (current-metas) is “undefined” outside of tag functions, which make sense 
> if you think about it: pollen.rkt can be used by several Pollen markup 
> files, and each markup file can define different metas. Therefore, outside 
> of tag functions, the concept of metas is not well-defined.
>
> On the other hand, a tag function is invoked from markup files, so it's 
> possible to associate metas to (current-metas).
> corr
>
> On Thu, Mar 28, 2019 at 5:12 PM Ifeoluwapo Eleyinafe <[email protected] 
> <javascript:>> wrote:
>
>> Thanks so much for the quick reply. So I tried to access (current-metas) 
>> from the pollen.rkt but I keep getting false.
>> I tried creating a test meta with (define-meta ...) but it was not 
>> accessible and it wasn't visible on (current-metas).
>> Tried running (select-from-metas) from pollen.rkt but metas was an 
>> unbound identifier.
>> I'm sure I'm doing something wrong. I'll keep re-reading the 
>> documentation.
>>
>> Thanks much for your help.
>>
>> On Thursday, March 28, 2019 at 11:21:27 AM UTC-4, Matthew Butterick wrote:
>>>
>>>
>>> On Mar 28, 2019, at 6:23 AM, Ifeoluwapo Eleyinafe <[email protected]> 
>>> wrote:
>>>
>>>
>>>  I think I can pull from metas using 'here-path but I don't know how to 
>>> access metas from pollen.rkt. I can do so from the template file but then I 
>>> won't be able to use the data in my tag definitions.
>>>
>>>
>>> Import `pollen/core` and use `current-metas`:
>>>
>>>
>>> https://docs.racket-lang.org/pollen/Core.html?q=current-metas#%28def._%28%28lib._pollen%2Fcore..rkt%29._current-metas%29%29
>>>  
>>> <https://docs.racket-lang.org/pollen/Core.html?q=current-metas#(def._((lib._pollen/core..rkt)._current-metas))>
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Pollen" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Pollen" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to