You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
422 B
27 lines
422 B
package LDV::Helpers; |
|
|
|
use strict; |
|
use warnings; |
|
use utf8; |
|
|
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
|
|
use Text::Markdown; |
|
|
|
sub register { |
|
my ($self, $app) = @_; |
|
|
|
$app->helper(markdown => sub { |
|
my ($c, $text) = @_; |
|
my $render = Text::Markdown->new; |
|
return $render->markdown($text); |
|
}); |
|
|
|
$app->helper(plaintext => sub { |
|
my ($c, $text) = @_; |
|
$text =~ s{\r?\n}{<br/>}go; |
|
return $text; |
|
}); |
|
} |
|
|
|
1;
|
|
|