I've tried to use both reusable code blocks and reusable values as argument to a function call (another template), but always end up in a compilation error: "illegal start of simple expression".
Let's say I have the header
template, which takes a string as argument. It is called this way: @header("My title")
Now, I want "My title" to be the result of a code block, or a value.
For example, I have tried this way for a code block:
@headerText(workbookArea: WorkbookArea, workbookItemName: String) = @{
workbookArea.className + " > " + workbookItemName
}
@header(@headerText(workbookArea, workbookItemName))
Or that way for a value:
@defining(workbookArea.className + " > " + workbookItemName) { headerText =>
@header(@headerText)
}
But none of these two code snippets compile. How is it supposed to be done?
That would be easier if you showed us an error, anyway - don't use the @
symbol within the brackets, it should be:
@header(headerText(workbookArea, workbookItemName))