Skip to content

Commit f387dc2

Browse files
committed
Remove some unneeded statements
1 parent 2d74508 commit f387dc2

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

lib/Mojolicious/Renderer.pm

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,8 @@ sub render {
109109
my $content = $stash->{'mojo.content'} //= {};
110110
local $content->{content} = $output =~ /\S/ ? $output : undef if $stash->{extends} || $stash->{layout};
111111
if ($stash->{inline_layout}) {
112-
@$options{qw(template inline)} = (undef, delete $stash->{inline_layout});
113-
$options->{format} = $stash->{format} || $self->default_format;
112+
@$options{inline} = delete $stash->{inline_layout};
114113
if ($self->_render_template($c, \my $tmp, $options)) { $output = $tmp }
115-
$content->{content} //= $output if $output =~ /\S/;
116114
}
117115
while ((my $next = _next($stash)) && !defined $inline) {
118116
@$options{qw(handler template)} = ($stash->{handler}, $next);
@@ -220,15 +218,6 @@ sub _next {
220218
return join '/', 'layouts', $layout;
221219
}
222220

223-
sub _render_content {
224-
my ($self, $c, $next, $options, $output) = @_;
225-
my $stash = $c->stash;
226-
@$options{qw(handler template)} = ($stash->{handler}, $next);
227-
$options->{format} = $stash->{format} || $self->default_format;
228-
if ($self->_render_template($c, \my $tmp, $options)) { $$output = $tmp }
229-
$stash->{'mojo.content'}->{content} //= $$output if $$output =~ /\S/;
230-
}
231-
232221
sub _render_template {
233222
my ($self, $c, $output, $options) = @_;
234223

t/mojolicious/layouted_lite_app.t

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ get '/inline/inline_layout' => sub {
102102
$c->render(inline => '<%= "inline!" %>', inline_layout => 'layouted_inline <%== content %>');
103103
};
104104

105+
get '/inline/template_with_inline_layout' => sub {
106+
my $c = shift;
107+
$c->render(template => 'variants', format => 'txt', inline_layout => 'layouted_inline <%== content %>');
108+
};
109+
105110
get '/inline/again' => {inline => 0};
106111

107112
get '/data' => {data => 0};
@@ -264,6 +269,10 @@ subtest 'Inline with layout' => sub {
264269
->content_is("layouted_inline inline!\n\n");
265270
};
266271

272+
subtest 'Template with inline layout' => sub {
273+
$t->get_ok('/inline/template_with_inline_layout')->status_is(200)->content_is("layouted_inline Desktop!\n");
274+
};
275+
267276
subtest '"0" inline template' => sub {
268277
$t->get_ok('/inline/again')->status_is(200)->header_is(Server => 'Mojolicious (Perl)')->content_is("0\n");
269278
};

0 commit comments

Comments
 (0)