> On Mar 15, 2018, at 6:00 AM, Joel Dueck <dueckofe...@gmail.com> wrote: > > I was pretty happy to learn about the web-server/templates package, which > allows you to include the contents of a template file and have it dropped > into the lexical context of the calling site. I’ve often wanted something > like this so I could write only a single copy of things like headers and > footers, and partials for listing chapters/articles in different contexts, > etc.
Pollen templates can do all this too, for a not-very-surprising reason (keep reading) ... > I started fiddling with it in a Pollen project and, come to realize it was > working even though I hadn’t `require`d or `provide`d any functions from > web-server/template. How is this possible, I think. Some digging revealed > that Pollen implements its own `include-template` function—and that it is > provided automatically for code inside a Pollen template. The `include-template` in Pollen is the same one as in `web-server/templates` [1] But I copied its source and changed it so that it could return binary files (like PDFs), which the usual one cannot. > have you thought about including it in the docs? It’s pretty useful, and the > docs could also help avoid confusion among those who already know about > web-server/template. The docs do mention that include-template is used behind > the scenes but not that it's also available in Pollen templates. With > appropriate warnings about XSS concerns. I suppose I could. I've just never been clear what could be done with `include-template` directly that isn't already possible through existing Pollen functions. When you apply a template to a markup source during a render, you're already using `include-template`. > might it also be worth providing or reimplementing web-server/template's `in` > function? [2] (maybe it already does so, I confess I haven’t checked yet) And > then, perhaps including it in the docs somewhere as well. Same — I suppose I've always thought that because Pollen has a notion of X-expressions and tag functions, they subsume `in` (which, unlike `include-template`, does no heavy lifting anyhow) [1] https://github.com/mbutterick/pollen/blob/master/pollen/private/include-template.rkt <https://github.com/mbutterick/pollen/blob/master/pollen/private/include-template.rkt> -- 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.