ActiveCampaign / mustachio

Lightweight, powerful, flavorful, template engine.
MIT License
207 stars 17 forks source link

Referring to individual array element #16

Open microdee opened 5 years ago

microdee commented 5 years ago

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?

JPVenson commented 5 years ago

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

microdee commented 5 years ago

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

JPVenson commented 5 years ago

i hope so :-D