How to use partial templates with a map in StringTemplate?

I have a map of city names => distance from the source.

I would like to use partial with this map and create something like this:

<ul>
<li>city1: distance1</li>
<li>city2: distance2</li>
<li>city3: distance3</li>
</ul>

What is the canonical way to do this with a StringTemplate?

Thank.

+3
source share
1 answer
<ul>
$amap.keys:{k | <li>$k$: $amap.(k)$</li>}$
</ul>
+5
source

Source: https://habr.com/ru/post/1780147/


All Articles