bBlog modifier truncatehtml
in the recent weeks handgestrickt wrote some very long blog-entries. these entries are sometimes not interesting for people visiting my mainpage, so they have to scroll down the whole page to find some topic. we thought about this problem for a while. there are several problems:
1. truncating the text might truncate HTML-tags.
2. truncating HTML distorts the letter count.
3. deleting HTML-tags, then truncating makes the entries plain and boring.
so we wrote a modifier for bBlog that truncates HTML content.
features:
1. truncates to an amout of letters.
2. tags are not included into the letter count.
3. HTML-entities are counted as one letter.
4. all open tags are closed, if necessary.
5. the order of the tags to close is preserved.
6. text can be appended.
7. truncates to the next whitespace, preserving words.
usage:
{$post.body|truncatehtml:$length:$append_text:$cutoff}
$length = new length of the text, default = 1000
$append_text = text to append to the result, default = ...
$cutoff = should the text be cutoff or should words be preserved, default = false
example:
{$post.body|truncatehtml:1000:"...":false}

