I wrote the code.
#? stdtmpl | standard
#import json
#proc generateIndexHTMLPage(title: string, tabs: openarray[JsonNode]): string =
# result = ""
<head><title>$title</title></head>
<body>
<div id="menu">
<ul>
#for item in items(tabs):
<li><a href=
#item["id"]
>
#item["name"]
</a></li>
#end for
</ul>
</div>
</body>
item is json like this {"id":1, "name": "hoge"}.
item is type JsonNode.
So, I should get id like item["id"]
expression 'item["id"]' is of type 'JsonNode' and has to be discarded
error.
however, I changed discard item["id"], it never return string...
I changed like this.
I used ${item["name"]}.
perhaps inside of ${} can use code?
#? stdtmpl | standard
#import json
#proc generateIndexHTMLPage(title: string, tabs: openarray[JsonNode]): string =
# result = ""
<head><title>$title</title></head>
<body>
<div id="menu">
<ul>
#for item in items(tabs):
<li><a href=users/${item["id"]}>${item["name"]}</a></li>
#end for
</ul>
</div>
</body>

However, double quote, " was shown...
And, multi byte string, like Japanese can't?
haha. I resolved myself!!
<li><a href=users/${item["id"]}>${item["name"].str}</a></li>
Glad you got it to work :)
Can I close?
@andreaferretti yes!