[pollen] How to access a pollen source's path in pollen.rkt

2016-12-29 Thread Alexander George McKenzie
Hello everyone —

Is there a way to access a pollen file's source path directly in the 
pollen.rkt? 

I know it's possible to pass it in using (current-contract-region), but 
that's a bit unwieldy.

Example: you define an ◊image function in pollen.rkt that pulls in images 
from different directories based on which chapter the current pollen source 
belongs to. You'd rather not have to call 
◊image[(current-contract-region)]{hamster.jpg} because it ruins the 
aesthetic grace of your pollen file ;) 

Is there a module I can require in pollen.rkt that will help me out?

Any suggestions warmly appreciated!

-A

-- 
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 pollenpub+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pollen] How to access a pollen source's path in pollen.rkt

2016-12-29 Thread Matthew Butterick

> On Dec 29, 2016, at 9:50 AM, Alexander George McKenzie  
> wrote:
> 
> I know it's possible to pass it in using (current-contract-region), but 
> that's a bit unwieldy.

Out of curiosity, why would you use that, rather than the `here-path` value in 
`metas`?



> Example: you define an ◊image function in pollen.rkt that pulls in images 
> from different directories based on which chapter the current pollen source 
> belongs to. You'd rather not have to call 
> ◊image[(current-contract-region)]{hamster.jpg} because it ruins the aesthetic 
> grace of your pollen file ;) 

I would probably convert `image` into a macro that expands into a function call 
that secretly passes `here-path` as an argument. An example of this approach:

https://groups.google.com/d/msg/pollenpub/KpcOlLUdQcg/jE1e2WrwAgAJ


-- 
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 pollenpub+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.