Statocles
view release on metacpan or search on metacpan
lib/Statocles/App/Perldoc.pm view on Meta::CPAN
# Add rel="external" for remaining external links
elsif ( $href =~ m{(?:[^:]+:)?//} ) {
$node->attr( rel => 'external' );
}
}
my $source_path = "$module/source.html";
$source_path =~ s{::}{/}g;
my ( @parts ) = split m{::}, $module;
my @crumbtrail;
for my $i ( 0..$#parts ) {
my $trail_module = join "::", @parts[0..$i];
if ( $modules{ $trail_module } ) {
push @crumbtrail, {
text => $parts[ $i ],
href => $self->url( $self->_module_href( $trail_module ) ),
};
}
else {
lib/Statocles/Document.pm view on Meta::CPAN
#pod The template path should not have the final extention (by default C<.ep>).
#pod Different template parsers will have different extentions.
#pod
#pod =cut
has template => (
is => 'rw',
isa => Maybe[ArrayRef[Str]],
coerce => sub {
return $_[0] if ref $_[0];
return [ grep { $_ ne '' } split m{/}, $_[0] ];
},
predicate => 'has_template',
);
#pod =attr layout
#pod
#pod ---
#pod layout: /site/layout-dark.html
#pod ---
#pod
lib/Statocles/Document.pm view on Meta::CPAN
#pod The template path should not have the final extention (by default C<.ep>).
#pod Different template parsers will have different extentions.
#pod
#pod =cut
has layout => (
is => 'rw',
isa => Maybe[ArrayRef[Str]],
coerce => sub {
return $_[0] if ref $_[0];
return [ grep { $_ ne '' } split m{/}, $_[0] ];
},
predicate => 'has_layout',
);
#pod =attr data
#pod
#pod ---
#pod data:
#pod ingredients:
#pod - Eggs
t/theme/template.t view on Meta::CPAN
subtest 'absolute directory' => sub {
my $store = Statocles::Store->new(
path => $SHARE_DIR->child( 'theme' ),
);
my $theme = Statocles::Theme->new(
store => $SHARE_DIR->child( 'theme' ),
);
my %exp_templates = read_templates( $store, $theme );
for my $tmpl ( @templates ) {
subtest $tmpl => sub {
cmp_deeply $theme->template( split m{/}, $tmpl ), $exp_templates{ $tmpl }, 'array of path parts';
cmp_deeply $theme->template( $tmpl ), $exp_templates{ $tmpl }, 'path with slashes';
cmp_deeply $theme->template( Path::Tiny->new( split m{/}, $tmpl ) ), $exp_templates{ $tmpl }, 'Path::Tiny object';
};
}
};
subtest 'relative directory' => sub {
my $cwd = getcwd();
chdir $SHARE_DIR;
my $store = Statocles::Store->new(
path => 'theme',
);
my $theme = Statocles::Theme->new(
store => 'theme',
);
my %exp_templates = read_templates( $store, $theme );
for my $tmpl ( @templates ) {
subtest $tmpl => sub {
cmp_deeply $theme->template( split m{/}, $tmpl ), $exp_templates{ $tmpl }, 'array of path parts';
cmp_deeply $theme->template( $tmpl ), $exp_templates{ $tmpl }, 'path with slashes';
cmp_deeply $theme->template( Path::Tiny->new( split m{/}, $tmpl ) ), $exp_templates{ $tmpl }, 'Path::Tiny object';
};
}
chdir $cwd;
};
subtest 'default Statocles theme' => sub {
my $theme = Statocles::Theme->new(
store => '::default',
);
( run in 0.560 second using v1.01-cache-2.11-cpan-5511b514fd6 )