In Mustache templating is there an elegant way of expressing a comma separated list without the trailing comma?

后端 未结 17 1614
滥情空心
滥情空心 2020-12-02 10:26

I am using the Mustache templating library and trying to generate a comma separated list without a trailing comma, e.g.

red, green, blue

17条回答
  •  再見小時候
    2020-12-02 11:00

    In case using Handlebars is an option, which extends the capabilities of Mustache, you could use a @data variable:

    {{#if @last}}, {{/if}}
    

    More info: http://handlebarsjs.com/reference.html#data

提交回复
热议问题