using pollen to generate pollen templates #77

Open
opened 4 years ago by v-nys · 1 comments
v-nys commented 4 years ago (Migrated from github.com)

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?

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](https://github.com/mbutterick/pollen-users/files/5537412/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?
mbutterick commented 4 years ago (Migrated from github.com)

only the null extension and the preprocessor extension are really used for templates.

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?

> only the null extension and the preprocessor extension are really used for templates. 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?
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/pollen-users#77
Loading…
There is no content yet.