You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ modules_html = include 'modules_html.scriban' }}
{{ modules_html[element.type](element) }}
include is a function that returns a string of the include but all variable declared in it is going to be visible in the currently bound this context. In that case your image/video functions are directly accessible via image(x,y,z) or this["image"](x,y,z)
If you wanted to capture to an object all the declarations of modules_html.scriban you would have to use with statement:
{{
modules_html = {}
with modules_html
$discard = include 'modules_html.scriban'
end
}}
Hello,
I'm trying to migrate nunjuck templates in scriban templates and I am wondering if in scriban we can call function based on dynamic name.
For example in nunjuck we have this :
in modules_html.njk we have :
For now, in scriban I have this :
And in modules_html.scriban :
But it's not really working. So is there an easy workaround for this type of thing ?
The text was updated successfully, but these errors were encountered: