bkiers / Liqp

An ANTLR based 'Liquid Template' parser and rendering engine.
MIT License
165 stars 94 forks source link

TemplateContext: provide access to Filters, Insertions, parent context #274

Closed kohlschuetter closed 1 year ago

kohlschuetter commented 1 year ago

Expose Filters and Insertions from a TemplateContext, and simplify creating a new child context by adding a newChildContext() helper method.

msangel commented 1 year ago

Thanks! @kohlschuetter Could you please take a look at that branch: https://github.com/bkiers/Liqp/pull/269 as I believe that will be the next version. There I have removed all static context where possible and left only those new classes that have been introduced by you last time. The API also changes a lot. Instead of different parse- protect- and render-setting all setting are stored directly in TemplateParser (the same way that provides a single point of default properties). This is a handy and easy approach to creating complex stuff in an easy way. For example the same approach from apache common-csv: image

SO we have similar now: image image image

msangel commented 1 year ago

And if that branch is not solving issues that this change intended to fix, we can will think how to apply this on top of that.

I will have free time next week somewhere to take a look closer tho this and that and maybe actually do release.

kohlschuetter commented 1 year ago

Great, thanks for the heads-up! I've rebased my changes on top of your branch.

msangel commented 1 year ago

@kohlschuetter In my latest changes, the Template doesn't own filters and insertions anymore, it's now a final part of TeplateParser. Therefore no need to have an extra exposing method, as one is already in place.
Also, I rolled-back the removal of Template constructors with different species of CharStream. People used to worth with familiar types: String, File, and InputStream.

Rebased and merged there: https://github.com/bkiers/Liqp/pull/279

Thanks!