Closed sonnylloyd closed 4 years ago
Hi @sonnylloyd, thanks for the question!
Right now, filter chaining is unfortunately actually broken. For now, the best solution would just be to create one filter that does the job of both filters (return str.substring(0,55).length
), until we push a fix.
Any more questions?
Fix is coming out in the next week :)
Describe the bug For some reason chaining filters seems to be getting the original string and not the filtered string.
Here is my defined filters also i swapped the tags due to my previous custom code engine (simple replace).
Sqrl.defaultTags(["{","}"]); Sqrl.defineFilter("excerpt", function (str) { return str.substring(0,55); }); Sqrl.defineFilter("length", function (str) { return str.length });
Here is the render code
stringIn = Sqrl.Render("{preset.description|excerpt|length}", { preset: { description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas felis dui, efficitur id erat id, suscipit dignissim orci. Vivamus at aliquet ex, non faucibus arcu. Ut posuere tempus imperdiet. Vestibulum dapibus justo sit amet semper aliquet. Pellentesque consequat eros bibendum semper sodales. Nunc ut mi eu magna elementum lobortis ut eget lacus. Suspendisse tincidunt lectus lacus, nec gravida turpis blandit in. Phasellus auctor finibus nisl vel luctus. Aliquam posuere placerat justo at egestas. Quisque aliquet risus quis pulvinar suscipit. Curabitur dapibus massa malesuada, blandit quam luctus, viverra augue. Fusce sapien mi, aliquet et est in, vestibulum sagittis nisl. Sed efficitur.', } });
it should return the number 55 but it returns 697 and the string it got in was not the string returned by the excerpt filter.
I cut this down as my application is a bit more complex. am i doing something wrong or is this a bug