Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible addition of a "basic" engine without the default filters and tags #102

Closed
1 task
jam3sn opened this issue Oct 24, 2024 · 1 comment
Closed
1 task

Comments

@jam3sn
Copy link
Contributor

jam3sn commented Oct 24, 2024

Checklist

  • [ x ] I have searched the issue list
  • I have tested my example against Shopify Liquid. (This isn't necessary if the actual behavior is a panic, or an error for which IsTemplateError returns false.)

Expected Behavior

Currently creating an instance of the Liquid Engine registers the various default tags, blocks and filters. I'd like to propose a "basic" variation of the engine which doesn't include these defaults.

Actual Behavior

Detailed Description

My use case is a limited liquid template that users can write some basic markup with access to a selection of variables (bindings) and a few custom filters, but nothing more. I attempted this creating my own instance of liquid.Engine{}, however found that if the template contained say a conditional block, an error would occur because Grammar is nil, and I can't use an instance of liquid.Config in liquid.Engine because cfg is private.

Here's a Go Playground of this in action: https://go.dev/play/p/VK98dDtODp4

Possible Solution

// NewBasicEngine returns a new Engine.
func NewBasicEngine() *Engine {
	reutrn &Engine{render.NewConfig()}
}

If this is something you are open to, I'd be happy to submit a PR for review. Or perhaps if you have another idea or solution that would be fantastic.

@jam3sn
Copy link
Contributor Author

jam3sn commented Nov 6, 2024

Merged in #104

@jam3sn jam3sn closed this as completed Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant