# Insert spaces to prevent the nodelets from getting too wide. # We leave the loopholes of using a bunch of "&nonentity;"s or # " -->" to intentionally make the nodelets wide (intended for # /msg'ing to yourself) as the problem is more accidents than abuse. # "&123" and "<" work in some browsers, but we might put spaces in # the middle of them (if you don't like it, then remember the ";"). my $len= 0; $text =~ s[(\s+)|([^\s<&]+)|(<[^<>]*>)|(&#?\w{1,10};)|(.)]` if( $1 ) { $len= 0; $1; } elsif( length( $2 ) ) { # $2 is the only case that can be "0" (ie. false) my $res= $2; my $tot= $len + length($res); if( 18 < $tot ) { my $max = 18 - $len; my $min = $max - 9; $min = 0 if $min < 0; $res =~ s[ ( \S{$min,$max} (?: (? 18 ? "$1 " : $1 }gex; $res =~ /(\S*)$/; $len= length( $1 ); } else { $len= $tot; } $res; } elsif( $3 ) { $3; } else { my $res= $4 || $5; my $add= $5 ? 1 : int( length($4)/3 ); $len += $add; if( 18 < $len ) { $len= $add; " $res"; } else { $res; } } `egis; return $text;