Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
more obvious order of precedence
  • Loading branch information
kraih committed Nov 10, 2015
1 parent af7493f commit 2cff7b2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/Mojolicious/Renderer.pm
Expand Up @@ -132,11 +132,11 @@ sub render {
return unless $self->_render_template($c, \$output, $options);
}

# Extends
# Inheritance
my $content = $stash->{'mojo.content'} ||= {};
local $content->{content} = $output if $stash->{extends} || $stash->{layout};
while ((my $extends = $self->_extends($stash)) && !defined $inline) {
@$options{qw(handler template)} = ($stash->{handler}, $extends);
while ((my $next = _next($stash)) && !defined $inline) {
@$options{qw(handler template)} = ($stash->{handler}, $next);
$options->{format} = $stash->{format} || $self->default_format;
$self->_render_template($c, \$output, $options);
$content->{content} = $output
Expand Down Expand Up @@ -224,11 +224,11 @@ sub warmup {
}
}

sub _extends {
my ($self, $stash) = @_;
$stash->{extends} ||= join('/', 'layouts', delete $stash->{layout})
if $stash->{layout};
return delete $stash->{extends};
sub _next {
my $stash = shift;
return delete $stash->{extends} if $stash->{extends};
return undef unless my $layout = delete $stash->{layout};
return join '/', 'layouts', $layout;
}

sub _render_template {
Expand Down

0 comments on commit 2cff7b2

Please sign in to comment.