Closed tarky closed 8 years ago
What error do you get with the first example?
Seems weird that case 1 doesn't work, with the =
added. That would be my expectation (after the padrino change(
@Arcovion The first exapmle doesn't outputs any html or any error. So my browser shows a white screen.
@tdreyno As you say, I tried adding =
to the first example like below
<%= wrap_layout :layout do %>
<article>
<%= yield %>
</article>
<% end %>
But it doesn't work and outputs following error.
SyntaxError: /Users/araky/blog/webfood/source/layouts/article.html.erb:1: syntax error, unexpected ')'
@_out_buf << ( wrap_layout :layout do ).to_s; @_out_buf << '
^
/Users/araky/blog/webfood/source/layouts/article.html.erb:9: syntax error, unexpected keyword_ensure, expecting ')'
/Users/araky/blog/webfood/source/layouts/article.html.erb:11: syntax error, unexpected keyword_end, expecting ')'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/tilt-1.4.1/lib/tilt/template.rb:264:in `class_eval'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/tilt-1.4.1/lib/tilt/template.rb:264:in `compile_template_method'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/tilt-1.4.1/lib/tilt/template.rb:240:in `compiled_method'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/tilt-1.4.1/lib/tilt/template.rb:169:in `evaluate'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/middleman-core-3.4.0/lib/middleman-core/core_extensions/rendering.rb:313:in `render_individual_file'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/middleman-core-3.4.0/lib/middleman-core/core_extensions/rendering.rb:153:in `render_template'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/middleman-core-3.4.0/lib/middleman-core/sitemap/resource.rb:127:in `block in render'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.2.4/lib/active_support/notifications.rb:166:in `instrument'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/middleman-core-3.4.0/lib/middleman-core/util.rb:41:in `instrument'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/middleman-core-3.4.0/lib/middleman-core/application.rb:241:in `instrument'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/middleman-core-3.4.0/lib/middleman-core/sitemap/resource.rb:14:in `instrument'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/middleman-core-3.4.0/lib/middleman-core/sitemap/resource.rb:100:in `render'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/middleman-blog-3.5.3/lib/middleman-blog/blog_article.rb:40:in `render'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/middleman-core-3.4.0/lib/middleman-core/core_extensions/request.rb:260:in `process_request'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/middleman-core-3.4.0/lib/middleman-core/core_extensions/request.rb:210:in `block in call!'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/middleman-core-3.4.0/lib/middleman-core/core_extensions/request.rb:209:in `catch'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/middleman-core-3.4.0/lib/middleman-core/core_extensions/request.rb:209:in `call!'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/middleman-core-3.4.0/lib/middleman-core/core_extensions/request.rb:195:in `call'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/urlmap.rb:66:in `block in call'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in `each'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in `call'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rack-livereload-0.3.16/lib/rack/livereload.rb:23:in `_call'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rack-livereload-0.3.16/lib/rack/livereload.rb:14:in `call'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/showexceptions.rb:24:in `call'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/lint.rb:49:in `_call'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/lint.rb:37:in `call'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:153:in `call'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:88:in `service'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/Users/araky/.rbenv/versions/2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
@tdreyno The Padrino change only made Slim/Haml use =
, eRB still uses <% %>
and they said they couldn't easily make it consistent.
@tarky Is this in v4.0 or v3.4? Can you post your Gemfile.lock
?
@Arcovion I use v3.4. My Gemfile.lock is here. https://gist.github.com/tarky/dc8b62122075b4ada175
Why is this closed? The doc seems not to have been modified yet.
Because the docs are correct, if there is a bug, it's in the code.
I heard the problem is from Padrino. If there is a bug in the code, the adoption of Padrino itself is a Middleman's bug, I think. But if we can't abandon Padrino for the time being, the only way is to explain in the doc.
I regard the purpose of this doc as an introduction for new commers, not just a spec description.
This issue still persists as of April 2016 :(
If you use nested layout, the doc tells
But this doesn't work, which is said to be because of change in Padrino. https://github.com/middleman/middleman/issues/1269
So you need to use use slim or haml like following, which works.
Or if you stick to erb, you can write like the below, though it's kind of ridiculous.
So could you guys make a judgement how to say things above in the document?