We have moved to GitHub Issues
Created by Richard Thompson 10 Jul 2017, 12:11:36 Updated by Shannon Deminick 12 Sep 2017, 03:37:37
Subtask of: U4-9609
The Umbraco Helper has a truncate method to allow you to truncate content to a particular number of characters. I think it would be useful to have an alternative method that truncates the content to a specified number of words.
Assuming this is the code to be reviewed? PR: https://github.com/umbraco/Umbraco-CMS/pull/2043
That's right Stephan, I'm the new guy, still getting the hang of it :).
Have added some comments to the PR on github
Changes: *Changed from the String object qualifier to type qualifier *Added HtmlSanitization package *Added check for invalid HTML and sanitation on WordsToLength and Truncate methods, sanitation result is not pretty, it most of the cases some text is removed for the sake of keeping the HTML valid. *Added some extra comments
Hrm, this is a lot of extra overhead for this single problem. Now we will be shipping 2 extra assemblies and dependencies simply to truncate words which we don't want to do. How come we need these extra dependencies all of a sudden?
Changes: *Reverted back to previous commit to simplify things *Added invalid html check to avoid infinite loop
Whohoo! Good work, good tests, all pass :)
Type: Feature (request)
Backwards Compatible: True
Affected versions: 7.6.3, 7.6.4, 7.6.5
Due in version: 7.6.7
Sprint: Sprint 67
Story Points: 1