I’ve got a fairly basic problem here that I’m hoping there is an easy
I have a chunk of html code that I want to truncate to a given length…
say 20 characters or so.
If I use the ‘truncate’ helper function I end up with unbalanced tags.
When run through the ‘truncate’ function, leaving off the closing tag,
causing untold trouble and chaos. On top of that, the trunctate
function counts characters in the tag, so you end up getting somewhat
less than what you asked for.
So… is there a way to truncate html text properly?
By this I mean a function or set of functions that returns a chunk of
html with the tags properly closed and where the length of the text
outside the tags is the specified amount.