mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-14 07:43:06 +00:00
ad4f267b7a
search.cpan.org is shutting down. It will redirect to metacpan.org after June 25, 2018. With hat: perl
15 lines
729 B
Plaintext
15 lines
729 B
Plaintext
When working with text it is convenient and common to want to truncate
|
|
strings to make them fit a desired context. E.g., you might have a menu
|
|
that is only 100px wide and prefer text doesn't wrap so you'd truncate
|
|
it around 15-30 characters, depending on preference and typeface size.
|
|
This is trivial with plain text and substr but with HTML it is somewhat
|
|
difficult because whitespace has fluid significance and open tags that
|
|
are not properly closed destroy well-formedness and can wreck an entire
|
|
layout.
|
|
|
|
HTML::Truncate attempts to account for those two problems by padding
|
|
truncation for spacing and entities and closing any tags that remain
|
|
open at the point of truncation.
|
|
|
|
WWW: https://metacpan.org/release/HTML-Truncate
|