sachatrauwaen / OpenContent

Structured Content editing for DNN (Dotnetnuke)
46 stars 25 forks source link

Handlebars helper "Contains" inconsitancy #165

Closed Timo-Breumelhof closed 3 years ago

Timo-Breumelhof commented 3 years ago

The documentation of this helper https://opencontent.readme.io/docs/tokens shows:

image

But that did not work the way I expected.

I found out it works like this: {{#contains "string" field}}

See also: https://github.com/sachatrauwaen/OpenContent/blob/a3dadd8cc7414ad622ff6bc3e0f0cd9aed41ae3a/OpenContent/Components/Handlebars/HandlebarsEngine.cs#L1118

IMO that's not logical, but I guess it's a breaking change if we fix it according to the documentation?

@hismightiness @sachatrauwaen

b-creative commented 3 years ago

I have also used it like this: {{#contains @index 1}} {{/contains}}

Timo-Breumelhof commented 3 years ago

I think that's because index = 1 so the comparison is 1 contains 1 and thus the order does not matter

WillStrohl commented 3 years ago

In my opinion, this is a necessary breaking change if all of the other implementations work differently.

sachatrauwaen commented 3 years ago

Fixed in v4.7