Trim certain punctuation from the end of truncated text output before appending suffix

Created on 8 January 2014, about 11 years ago
Updated 9 January 2025, 10 days ago

I found this module when searching for a way to append an ellipsis to the end of teasers to indicate that one should look for the "Read More" button (I guess the button alone wasn't intuitive to indicate more text). It works pretty well as expected, except for the fact that on both character and word modes, and with HTML stripping both on and off, it will sometimes append the ellipsis to punctuation like commas or quotation marks rather than trimming to a word and then adding the ellipsis. For example, we'll get things like:

Original: "The brown fox, who was quick."
Desired trim: "The brown fox..."
Actual trim: "The brown fox,..."

I don't know enough about development to know if it's possible to move the trim to the last actual letter instead of punctuation, but if it is possible, I'm sure I'm not the only person who would find it better. Thanks!

✨ Feature request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Thambos

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024