Closed SomaticIT closed 3 years ago
Hi @SomaticIT! Glad to hear you like this project! Unfortunately, it's not going to be possible to use (
, )
, |
, or =>
inside of the closing delimiters. I looked for a while at possibilities, but it would just be too complex.
Could you just slightly change the delimiters?
Example:
Sqrl.defaultConfig.tags = ["\\${", "}"]
// $ has to be escaped because it's a RegExp special char
const template = "Hi ${it.name}"
Sqrl.render(template, { name: "@SomaticIT" })
// "Hi @SomaticIT"
Describe the bug When using some custom tags, the whole template engine breaks.
["[", "]"]
breaks because it should be escaped,["\\$\\(", "\\)"]
breaks because parens are interpreted by squirrelly.To Reproduce Steps to reproduce the behavior:
Sqrl.defaultConfig = ["\\$\\(", "\\)"];
const template = "Data: $(test)";
Sqrl.render(template, { test: "value" });
Expected behavior Render result should be:
Data: value
Package & Environment Details
Additional context I develop a software that already use the syntax
$(property)
for its users. We built a very simple template engine that need to evolve. We selected your project to replace our template engine with something far more powerful.I love your project as it's well developped, light and fast. I would be very happy to be able to run your project in my software.
Do you think it's possible?
Thanks