Skip to content

Replacement in partial removes a newline #86

@noel-yap

Description

@noel-yap

Test:

func TestMustacheRenderPartials(t *testing.T) {
	expected := "header\n\n\tline 1\n\tline 2\n\nfooter\n"

	staticProvider := &mustache.StaticProvider{
		Partials: map[string]string{
			"body": strings.Join([]string{
				"\tline 1",
				"\tline 2",
			}, "\n"),
		},
	}

	actual, err := mustache.RenderPartials(
		"header\n\n{{> body}}\n\nfooter\n",
		staticProvider,
		map[string]string{},
	)

	assert.NoError(t, err)
	assert.Equal(t, expected, actual)
}

I'm expecting there to be two newlines after replacing {{> body}} in the template but there's only one newline after that replacement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions