- Issue created by @xopoc
The readmore module trims text in unexpected places, leading to awkward and incomplete sentences. For example, when the trim length is set to 100 characters, and the text is:
"As the sun began to set, casting a warm, golden glow over the small town of Oakridge, Mr. Thompson strolled down Maple Street."
it trims to:
"As the sun began to set, casting a warm, golden glow over the small town of Oakridge, Mr..."
instead of:
"As the sun began to set, casting a warm, golden glow over the small town of Oakridge, Mr. Thompson..."
This results in an abrupt display of text, affecting readability and user experience.
After debugging the module, I identified that the code in the readmore_truncate_string() function is deciding to cut within the first paragraph, which contributes to this issue.
Expected result:
The text should be trimmed to complete sentences, such as:
"As the sun began to set, casting a warm, golden glow over the small town of Oakridge, Mr. Thompson..."
Actual result:
The text is trimmed abruptly, resulting in:
"As the sun began to set, casting a warm, golden glow over the small town of Oakridge, Mr..."
To improve the readmore module, the feature "If the first paragraph is too long, split at the end of a sentence" should be made optional. This would allow users to enable or disable this behavior based on their preferences.
Active
2.0
Code