Closed nebrelbug closed 4 years ago
Note: these are taken from "TODO.md" and "Thoughts.md"
copyProps
doesn't deep-link plugins(?:[^]*?|(?:'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'|`(?:\\[\s\w"'\\`]|[^\\`])*?`|"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"))*?(?:([|()]|=>)|\/\*[^]*?\*\/|((\/)?(-|_)?}}))
(?:(?:'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'|`(?:\\[\s\w"'\\`]|[^\\`])*?`|"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?")|\/\*[^]*?\*\/|[^])*?(?:([|()]|=>)|((\/)?(-|_)?}}))
What about the ability to parse like this {{~i18n`hello ${world}`/}}
its nothing major i currently just use {{~i18n('hello ' + world)/}}
or {{ 'Template string' | i18n }}
@insider777 hmm that would be really nice, but I don't think there's an easy way to add that behavior exactly. You could pass in i18n
as data though and then do
{{it.i18n`hello ${world}`}}
By the way, quick question: it looks like you're using the beta of Squirrelly v8. Recently, I've considered changing the default helper "prefix" to @
instead of ~
, to make it easier to type for people with international keyboards. I would then allow prefixes to be customized.
Do you have any feedback on this? Would you prefer to type {{@i18n('hello ' + world)/}}
rather than {{~i18n('hello ' + world)/}}
?
Thanks for the feedback!
The version 8.0.4 seems not working with express
res.render('index', { name: "test"})
ReferenceError: name is not defined
i tested with version 7.0.4, 7.9.2 and it works, it does also not working with version 8.0.0
Hi @w3hr! There have been some significant changes to Squirrelly's syntax since version 7, so your Squirrelly v7 templates most likely will not work with Squirrelly v8.
The new Squirrelly docs are at https://squirrelly.js.org
Let me know if you have any questions! :grin:
ok my bad, thx
@nebrelbug is it possible to pass in the entire it
context and append any key=>value pairs? There is a ton of customizations with data transformations that take place based on logic which would be much easier to do in native js/ts. something like
/* it context
{
name: "Jon",
title: "not-awesome"
}
*/
// this is a helper
transform(it, cb)
cb(context) {
if(context.name === "Jon") return { _realTitle: "not-too-shabby", ...context }
else return context
}
@jmclean-cnexus I don't quite understand what your problem is. Do you want to modify it
before rendering your template?
@nebrelbug no problem at all...just thinking out loud really. I work in Fintech and we have a lot of it.calculated
.
So, in short...yes! Feel free to toss this aside, just thinking out loud and there may be more graceful ways to do this
@jmclean-cnexus ok, that makes sense. On first thought, I think it's probably best to leave this up to the user to handle before they render their templates so as to keep bundle size low.
I'm open to suggestions though :), so if you think this feature would be helpful feel free to open an issue or PR.
This is an issue for me (as a maintainer) to keep track of To-do items and random ideas.