liquid
liquid copied to clipboard
feat: add UnregisterTag engine method
The aim of this PR is to add a function that allows to remove a defined tag. This is useful for my specific need as I need to disable a standard tag ({% include %}) and still get a parse error.
Currently in order to disable a standard tag, you can:
// Register a tag that always returns an error
engine.RegisterTag("include", func(c render.Context) (string, error) {
return "", fmt.Errorf("Tag include is not allowed")
})
This overrides the existing tag functionaly of include and will throw an error at render time. Adding UnregisterTag allows to remove standard tags dinamically.
Checklist
- [x] I have read the contribution guidelines.
- [x]
make testpasses. - [x]
make lintpasses. - [x] New and changed code is covered by tests.
- [ ] Performance improvements include benchmarks.
- [ ] Changes match the documented (not just the implemented) behavior of Shopify.