Skip to content

Instantly share code, notes, and snippets.

@masak
Created November 13, 2008 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masak/24637 to your computer and use it in GitHub Desktop.
Save masak/24637 to your computer and use it in GitHub Desktop.
method format($text) {
my @result_pars;
for split(/\n ** 2..*/, $text) -> $paragraph {
my $cleaned_of_whitespace = $paragraph.trans(
[ /\s+/ => ' ' ]
);
push @result_pars, "<p>$cleaned_of_whitespace</p>";
}
return join "\n\n", @result_pars;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment