Committer: iaskarov
LJSUP-7307 Rules of post parsingU trunk/cgi-bin/LJ/Text.pm
Modified: trunk/cgi-bin/LJ/Text.pm =================================================================== --- trunk/cgi-bin/LJ/Text.pm 2010-12-20 09:46:53 UTC (rev 17978) +++ trunk/cgi-bin/LJ/Text.pm 2010-12-20 10:10:34 UTC (rev 17979) @@ -222,12 +222,19 @@ my $ellipsis = delete $opts{'ellipsis'} || Encode::encode_utf8("\x{2026}"); my $fill_empty = delete $opts{'fill_empty'} ? 1 : 0; my $punct_space = delete $opts{'punct_space'} ? 1 : 0; + my $strip_html = delete $opts{'strip_html'} ? 1 : 0; + my $force_ellipsis; cluck "unknown options: " . Dumper(\%opts) if %opts; cluck "not actually truncating" unless $bytes || $chars; + + if($strip_html) { + $force_ellipsis = ($str =~ /<img/i) ? 1 : 0; + $str = LJ::strip_html($str, { use_space => 1 }); + } my $remove_last_word = sub { my ($str) = @_; @@ -273,6 +280,8 @@ } $str .= $ellipsis; + } elsif($force_ellipsis) { + $str .= $ellipsis; } $str ||= $ellipsis if($fill_empty);