javascalamustachescalate

Loop over java Map with scalate's mustache implementation


Can mustache loop over a java Map? My object:

Map<Integer, String> mapTest

Tried this in my mustache template:

{{#mapTest}}
  {{.}}
{{/mapTest}}

That spits out a string representation (mapTest.toString()) of the entire object but doesn't loop at all.


Update: In hunting through the source I'm getting closer but still not sure how to do it. https://github.com/scalate/scalate/blob/ec981338c067fcf37106fb5f3bdf2fa8c4e458ca/scalate-core/src/main/scala/org/fusesource/scalate/mustache/Scope.scala#L124-125


Solution

  • See this answer on the mailing list...

    http://groups.google.com/group/scalate/msg/100df004001d84f0