ActiveCampaign / mustachio

Lightweight, powerful, flavorful, template engine.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Referring to individual array element

microdee opened this issue · comments

I have given model

{
   "array": [ "foo", "bar", "fizz", "buzz"]
}

in mustache.js you can access individual array elements with this syntax: {{array.2}} which should return "fizz". I tried it with Mustachio and unfortunately it doesn't work. It just interpolates to nothing, no exceptions thrown.
Is there a working way of doing this in Mustachio? If not is there an argument against it?

Hey @microdee.
mustachio array accessors are not Impediment yet. See https://github.com/wildbit/mustachio/blob/7e0c16c8d35133e3ba837d88af349be76decd0b2/Mustachio/ContextObject.cs#L38

Mustachio have not gotten any feature update since a few years, but i have forked it and made a few changes to it you might want to check it out:
https://github.com/JPVenson/morestachio

hey thanks for the tip! I'll check out morestachio later, maybe implement the array accessor if I get bored

i hope so :-D