Skip to content

Named arguments with include #171

@jimmytsoares

Description

@jimmytsoares

Hello! I'm working with Scriban for the last couple weeks and I'm trying to learn almost everything possible to do with Scriban.

Today I stumbled across something that's being hard to figure out. Is it possible have named arguments with the Include function?
I'm trying something like this:
{{ include 'test.html' teststring: 'abc'}}
And suppose 'test.html' is:
<h1>{{$teststring}}</h1>
I would expect the output to be:
<h1>abc</h1>
However I'm only getting blank results. When I use:
<h1>{{$1}}</h1>
I get the expected results, so that me wonder if I can have or not named arguments with the include funtion. But then when I just tried printing {{$}} I got [, teststring: abc], making me think that it is possible since the information is in the $ array.

I've already tried the following to get the teststring argument:
{{$teststring}},{{$[teststring]}},{{$.teststring}}

Thanks for this awesome templating engine!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions