mirror of
https://github.com/danog/liquid.git
synced 2024-11-26 19:44:45 +01:00
Stop trimming ASAP
This commit is contained in:
parent
5cbe290051
commit
3c60e26a82
@ -25,6 +25,9 @@ func (tw *trimWriter) Write(b []byte) (int, error) {
|
||||
n := len(b)
|
||||
if tw.trimRight {
|
||||
b = bytes.TrimLeftFunc(b, unicode.IsSpace)
|
||||
if n != 0 {
|
||||
tw.trimRight = false
|
||||
}
|
||||
} else if tw.buf.Len() > 0 {
|
||||
if err := tw.Flush(); err != nil {
|
||||
return 0, err
|
||||
|
@ -36,7 +36,7 @@ func TestIncludeTag(t *testing.T) {
|
||||
buf = new(bytes.Buffer)
|
||||
err = render.Render(root, buf, includeTestBindings, config)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "value", strings.TrimSpace(buf.String()))
|
||||
require.Equal(t, "test value", strings.TrimSpace(buf.String()))
|
||||
|
||||
// errors
|
||||
root, err = config.Compile(`{% include 10 %}`, loc)
|
||||
|
2
tags/testdata/include_target_2.html
vendored
2
tags/testdata/include_target_2.html
vendored
@ -1 +1 @@
|
||||
{% if test %}{{ var }}{% endif %}
|
||||
{%- assign myVar = "test" -%}test {% if test %}{{ var }}{% endif %}
|
Loading…
Reference in New Issue
Block a user