Allow tp.file.include to accept data to populate a template. #1498
clearf
started this conversation in
Ideas & Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It would be nice to be able to pass data to a template.
For example, I often use a pattern where I'll use the selection from a file as input to a template, which will often require some processing.
What I'd like to do is be able to separate the formatting/output from the data processing. For example, imagine:
Template
Base template
This doesn't work, because there's no "data" argument to tp.file.include
Instead I end up having to include the formatting of my output within the logic, which is ugly.
It would be nice if tp.file.include would let us specify some kind of data payload.
e.g., await tp.file.include("[[test template]]", data);
Obviously this is a toy example. Being able to do this would add a lot of flexibility and reduce unnecessary code/template duplication. And who doesn't like that?
Beta Was this translation helpful? Give feedback.
All reactions