Closed deanebarker closed 5 years ago
Maybe that's just a bug
I'll leave that to you to judge, but if so, it's a fairly benign one, because there's a workaround.
But, good to know.
Here's the line it's coming from:
https://github.com/lunet-io/scriban/blob/master/src/Scriban/Syntax/ScriptWrapStatement.cs#L26
Right, it's not a bug but the documentation is actually wrong as you need to add a @
before the function: wrap @caption
I assumed that the only thing that could go there is a function name, so what is the @
meant to represent? That makes it seem that the function name is meant to be differentiated from something else -- what would that something else be?
Also, this didn't seem to work. This code...
{{ wrap @aside }}
...now throws this error:
Expecting a direct function instead of the expression `FunctionAliasaside/unary expression`
I assumed that the only thing that could go there is a function name, so what is the @ meant to represent? That makes it seem that the function name is meant to be differentiated from something else -- what would that something else be?
Not exactly, you could have a function that returns a function pointer. Maybe things got broken after I introduced function pointers.
Also, this didn't seem to work. This code...
Yeah, sorry, I don't know what's going on. I'm on a business trip for the next 2 weeks and I can't check more deeply that issue for now, unless you go into it before.
No worries. I have a workaround.
I did try to look into the code, but I got lost fairly quickly. Just know that I tried.
Actually got a chance to have a look at it and it should be fixed by commit 287d936
The fix will be available in an upcoming release
Say I have an HTML construct that I put in function:
I want to call it like this:
However, this throws a parsing error because there is no extra parameter on the
wrap
call, even though I don't need one:Why is this? I don't need any extra parameters except what's in the
wrap
block itself. What I end up doing is calling it like this:Essentially, I pass an extra parameter as an empty string, and just don't do anything with it. But, clearly, this is hack-ish and not something I want to get in the habit of doing.
What am I not understanding here?