-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
I'd like to pre-populate some fields in a template that will always be the same in order to improve performance. For example:
Hello {{user}}, welcome to {{server}}.
I'd like to prepopulate {{server}} since it will not change and this template will be generated potentially millions of times.
My first naive attempt to do this looked like this:
kainjow::mustache::data global_data;
global_data.set("server", get_hostname());
kainjow::mustache::mustache t = kainjow::mustache::mustache(template_str).render(global_data);However this deletes the {{user}} field so the code
t.render({ "user", provided_username });results in
Hello , welcome to localhost.
So, two questions:
- Is there a way to do this without manually setting each variable to
"{{variable}}"? - Would could this actually improve performance?
Thanks!
Metadata
Metadata
Assignees
Labels
No labels