Problem/Motivation

Currently, the Smart Trim module only allows for text trimming based on the number of words or characters. However, there are cases where it would be useful to trim text based on the number of sentences, such as when displaying snippets of long articles or product descriptions.

Proposed resolution

To address this limitation, we propose adding a new option to Smart Trim that allows users to specify the maximum number of sentences to display. This new functionality will be based on the existing word-trimming algorithm but will count sentences instead of words. The algorithm will identify sentence boundaries using common sentence-ending punctuation (such as periods, question marks, and exclamation marks), and will ensure that the trimmed text always ends on a complete sentence.

Issue fork smart_trim-3358934

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

snig created an issue. See original summary.

ultimike’s picture

Status: Active » Closed (duplicate)
Related issues: +#2854541: Trim paragraph containing word count