diff --git a/filters.go b/filters.go index d08e934..2480944 100644 --- a/filters.go +++ b/filters.go @@ -215,7 +215,7 @@ func filterTruncatesentencesHtml(in *pongo2.Value, param *pongo2.Value) (*pongo2 return idx }, func() {}) - return pongo2.AsValue(new_output.String()), nil + return pongo2.AsSafeValue(new_output.String()), nil } func filterTimeuntilTimesince(in *pongo2.Value, param *pongo2.Value) (*pongo2.Value, error) { diff --git a/filters_test.go b/filters_test.go index 30db2ba..f38aeff 100644 --- a/filters_test.go +++ b/filters_test.go @@ -77,10 +77,10 @@ func (s *TestSuite1) TestFilters(c *C) { Equals, "This is a first sentence with a 4.50 number. The second one is even more fun! Isn't it?") // Truncatesentences_html - c.Assert(pongo2.RenderTemplateString("{{ text|truncatesentences_html:2|safe }}", pongo2.Context{ + c.Assert(pongo2.RenderTemplateString("{{ text|truncatesentences_html:2 }}", pongo2.Context{ "text": `
`}), Equals, `
`) - c.Assert(pongo2.RenderTemplateString("{{ text|truncatesentences_html:3|safe }}", pongo2.Context{ + c.Assert(pongo2.RenderTemplateString("{{ text|truncatesentences_html:3 }}", pongo2.Context{ "text": `
`}), Equals, `
`) }