From 640ef3ff281a4df576d7fc669cf6b51e2bfe3a76 Mon Sep 17 00:00:00 2001 From: Florian Schlachter Date: Wed, 1 Oct 2014 22:18:12 +0200 Subject: [PATCH] It's not necessary anymore to apply the 'safe' filter on the 'truncatesentences_html'-filter. --- filters.go | 2 +- filters_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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, `
`) }