Created
July 15, 2012 02:45
-
-
Save sshaw/3114566 to your computer and use it in GitHub Desktop.
HTML Paragraph Helper for Mojolicious
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Turn text from a text area into HTML paragraph elements. | |
$self->helper(paragraphs => sub { | |
my ($c, $text) = @_; | |
return unless $text; | |
my $html = join '', map $c->tag('p', $_), split /^\s*\015\012/m, $text; | |
Mojo::ByteStream->new($html); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment