StubbleOrg / Stubble

Trimmed down {{mustache}} templates in .NET
Other
401 stars 58 forks source link

how to render list with comma separated values without trailing comma? #77

Closed amithegde closed 4 years ago

amithegde commented 4 years ago

I noticed https://github.com/samskivert/jmustache has a feature to print comma separated values without trailing comma using a template like this:

{{#items}}{{name}}{{^-last}}, {{/-last}}{{/items}}

what is the recommended approach here?

Romanx commented 4 years ago

Hi there,

We deliberately try to implement the mustache standard without any of the extras that other implementations provide.

There are some standard mustache ways of doing this which is usually manipulating your data which you can find here.

You can register your own tag parsers and handlers to add such functionality (and also provide it in an extension package).

Another option is to use our alpha package of helper functions which provide some custom functionality which you can find here.

Hope that helps,