Make truncate Character Entity Reference aware - fixes bug #95707#188
Closed
Make truncate Character Entity Reference aware - fixes bug #95707#188
Conversation
Collaborator
Author
|
original request from @ozcoder I have improved the truncate filter to be aware of HTML Character Entity References for the truncate character. Ideally we would do something simular to the input text $context too. This fixes bug https://rt.cpan.org/Ticket/Display.html?id=95707. |
0c2da20 to
e0d5f00
Compare
(cherry picked from commit a9ba3869f33be68a324c7c6718081c25811724bd) Signed-off-by: Nicolas R <nicolas@atoomic.org>
Koan-Bot
added a commit
to atoomic/Template2
that referenced
this pull request
Feb 14, 2026
The truncate filter now correctly handles HTML Character Entity References (CERs) like … … … in both the suffix string and the input text. Previously, … was counted as 8 characters by length(), causing the truncate filter to remove more text than intended. Now CERs are counted by their visual width (1 character each), and CERs in the input text are never split mid-reference. Adds _visual_length() and _truncate_visual() helper functions. Fixes RT#95707. Ref: abw#188 Co-Authored-By: Kōan <koan.bot@atoomic.org>
This was referenced Feb 14, 2026
Collaborator
|
moved to #332 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.