I need to create a complex html-table inside a Swift Vapor App.
Problem is: Leaf doesn't seem to support counting up variables like #(somevar += 1) nor concatenating string variables like #(somevar1 + somevar2)
So I decided to create my complex table inside the App and transfer it to the html template inside a variable. (in php I'm used to doing this all the time)
In the template I'd call the variable like
#(table)
but turns out, I'm getting the plain html code as leaf escapes all variables.
But there is the #raw() function to print out plain html as such.
So I do
<!DOCTYPE html>
<html lang="de">
<head><title>Server</title></head>
<body>
<..>
<form action="parameters" method="post">
// here is the thing: leaf gets a html table within the string 'table'.
// If I do it like that lead doesn't recognize #(table) as a leaf variable.
#raw( #(table) )
<button type="submit">Save</button>
</form>
</body>
</html>
only to find out that #raw() does not look for variables but just prints out unescaped what is between the {}. So I still get in the website "#(table)" instead of my complex html-table.
So now I'm stuck. How do I get App-generated html code into the template as html?
Probably I am doing this all wrong. How do I get html code inside a leaf template at all? Or do I have to send the whole page then myself, as a http stream with a header…?
Thanks in advance, Tom