-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
|truncate filter doesn't truncate at the nearest sentence end #3903
Comments
Everything works as instructed. What do you want to return? If |
In my world a sentence will end at the nearest sentence-ending punctuation (like ., !, or ?) |
Although the example used in the documentation is in fact right, the explanation is not... The following code used as an example in the docs returns the truncated texts as expected:
However, the explanation is not correct. The See the code for truncate. You can provide your own breaking character, like a point, but you cannot provide multiple punctuations, or a regex.
You might consider creating a PR on the docs. Or you could create a PR to improve the Btw. when using the content of variable |
The docs don't match reality. Truncate cuts at the nearest word, not the end of a sentence.
Example:
summary: 'one not so long sentence. two sentences'|truncate(5, true)|raw
Renders as:
one not…
The text was updated successfully, but these errors were encountered: