diff --git a/engine.go b/engine.go index 5bfe89c..814e60e 100644 --- a/engine.go +++ b/engine.go @@ -21,6 +21,11 @@ func NewEngine() *Engine { return &e } +// NewBasicEngine returns a new Engine without the standard filters or tags. +func NewBasicEngine() *Engine { + return &Engine{render.NewConfig()} +} + // RegisterBlock defines a block e.g. {% tag %}…{% endtag %}. func (e *Engine) RegisterBlock(name string, td Renderer) { e.cfg.AddBlock(name).Renderer(func(w io.Writer, ctx render.Context) error { diff --git a/engine_test.go b/engine_test.go index 2a7a4a0..9187e86 100644 --- a/engine_test.go +++ b/engine_test.go @@ -40,6 +40,25 @@ func TestEngine_ParseAndRenderString(t *testing.T) { } } +func TestBasicEngine_ParseAndRenderString(t *testing.T) { + engine := NewBasicEngine() + + t.Run("1", func(t *testing.T) { + test := liquidTests[0] + out, err := engine.ParseAndRenderString(test.in, testBindings) + require.NoErrorf(t, err, test.in) + require.Equalf(t, test.expected, out, test.in) + }) + + for i, test := range liquidTests[1:] { + t.Run(strconv.Itoa(i+2), func(t *testing.T) { + out, err := engine.ParseAndRenderString(test.in, testBindings) + require.Errorf(t, err, test.in) + require.Equalf(t, "", out, test.in) + }) + } +} + type capWriter struct { bytes.Buffer }