48 lines
923 B
Perl
48 lines
923 B
Perl
|
package Classy::Simple;
|
||
|
|
||
|
use strict;
|
||
|
use warnings;
|
||
|
use namespace::autoclean;
|
||
|
|
||
|
our $VERSION = '0.10';
|
||
|
|
||
|
use Classy::Handler::Fragment;
|
||
|
use Params::ValidationCompiler qw( validation_for );
|
||
|
use Markdent::Parser;
|
||
|
use Markdent::Types;
|
||
|
|
||
|
use Moose;
|
||
|
|
||
|
with 'Markdent::Role::Simple';
|
||
|
|
||
|
{
|
||
|
# Validator from Markdent::Simple::Fragment
|
||
|
my $validator = validation_for(
|
||
|
params => [
|
||
|
dialects => {
|
||
|
type => t( 'ArrayRef', of => t('Str') ),
|
||
|
default => sub { [] },
|
||
|
},
|
||
|
markdown => { type => t('Str') },
|
||
|
],
|
||
|
named_to_list => 1,
|
||
|
);
|
||
|
|
||
|
sub markdown_to_html {
|
||
|
my $self = shift;
|
||
|
my ( $dialects, $markdown ) = $validator->(@_);
|
||
|
|
||
|
my $handler_class = 'Classy::Handler::Fragment';
|
||
|
|
||
|
return $self->_parse_markdown(
|
||
|
$markdown,
|
||
|
$dialects,
|
||
|
$handler_class,
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
1;
|
||
|
|
||
|
__END__
|