liquid icon indicating copy to clipboard operation
liquid copied to clipboard

Expose the template lexical environment

Open aisbergg opened this issue 3 years ago • 0 comments

I like to implement a tag, that require the full lexical context (bindings) to be copied. Currently the render.Context interface exposes the Get and Set function to manipulate the bindings, but those don't let me iterate over the whole thing. Thus, this PR adds a function that returns the full bindings. Usage example:

func (tc tagContext) myTag(rc render.Context) (s string, err error) {
	bindings := rc.Bindings()
	...
}

Checklist

  • [x] I have read the contribution guidelines.
  • [x] make test passes.
  • [x] make lint passes.
  • [ ] New and changed code is covered by tests.
  • [ ] Performance improvements include benchmarks.
  • [ ] Changes match the documented (not just the implemented) behavior of Shopify.

aisbergg avatar Apr 22 '22 17:04 aisbergg