It's not necessary anymore to apply the 'safe' filter on the 'truncatesentences_html'-filter.
This commit is contained in:
		@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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": `<div class="test"><ul><li>This is a first sentence with a 4.50 number.</li><li>The second one is even more fun! Isn't it?</li><li>Last sentence, okay.</li></ul></div>`}),
 | 
			
		||||
		Equals, `<div class="test"><ul><li>This is a first sentence with a 4.50 number.</li><li>The second one is even more fun!</li></ul></div>`)
 | 
			
		||||
	c.Assert(pongo2.RenderTemplateString("{{ text|truncatesentences_html:3|safe }}", pongo2.Context{
 | 
			
		||||
	c.Assert(pongo2.RenderTemplateString("{{ text|truncatesentences_html:3 }}", pongo2.Context{
 | 
			
		||||
		"text": `<div class="test"><ul><li>This is a first sentence with a 4.50 number.</li><li>The second one is even more fun! Isn't it?</li><li>Last sentence, okay.</li></ul></div>`}),
 | 
			
		||||
		Equals, `<div class="test"><ul><li>This is a first sentence with a 4.50 number.</li><li>The second one is even more fun! Isn't it?</li></ul></div>`)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user