# First encode possible HTML, because the text is # supposed to be plain text use HTML::Entities(); $text = HTML::Entities::encode($text); # Convert Windows or Mac line terminators to Unix single \n $text =~ s/\r\n|\n\r/\n/g; # Remove leading and trailing white space $text =~ s/^\s*//; $text =~ s/\s*$//g # Convert all double line breaks to para tags $text =~ s|\n\s*\n|</p><p>|g # Convert any single line breaks to br tags $text =~ s|\n\s*|<br />|g # If text is more than just white space, add opening and # closing para tags $text = "<p>$text</p>" if $text;
In reply to Re: Formatting paragraph
by clinton
in thread Formatting paragraph
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |