using pollen to generate pollen templates
#77
Open
opened 3 years ago by v-nys
·
1 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Hi,
I have a project I'm working on that has three separate templates, all of which share certain elements but which are too different to elegantly handle with conditional code. So I figured I could generate a template by writing .pm source files for the derived templates. But, as far as I can tell, only the null extension and the preprocessor extension are really used for templates.
I got this to work for my scenario, but I pretty much just went in and started tinkering even though I have no real knowledge of the Pollen code base. Essentially, I added a
lozenge
tag function (which inserts a lozenge character in the output), had the base template include the generated derived template via◊(select* 'root doc)
. In the Pollen code base, I made the change in the patch which I have attached.templatepatch.txt
Would this break anything in the long run? Is there a way of handling this without patching Pollen? If this seems like a valid way of doing things, do I make a pull request?
Right, because otherwise Pollen needs to support templates for templates, which leads to some notational difficulties around the semantics of
◊
.As for your patch, it may fix a legitimate flaw, though I’d like to understand more precisely why the templates are ”too different to elegantly handle with conditional code”. Can you show a simplified example?