From 3acfc374fe875165120f7fe740a0d189f6e47037 Mon Sep 17 00:00:00 2001 From: stjhimy Date: Fri, 29 Jul 2016 07:26:44 -0300 Subject: [PATCH] Update content_for docs --- sinatra-contrib/lib/sinatra/content_for.rb | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/sinatra-contrib/lib/sinatra/content_for.rb b/sinatra-contrib/lib/sinatra/content_for.rb index 6b4c4ef4..0d444d15 100644 --- a/sinatra-contrib/lib/sinatra/content_for.rb +++ b/sinatra-contrib/lib/sinatra/content_for.rb @@ -68,6 +68,46 @@ module Sinatra # layout, inside the tag, and each view can call content_for # setting the appropriate set of tags that should be added to the layout. # + # == Limitations + # + # Due to the rendering process limitation using <%= yield_content %> + # from within nested templates do not work above the <%= yield %> statement. + # For more details https://github.com/sinatra/sinatra-contrib/issues/140#issuecomment-48831668 + # + # # app.rb + # get '/' do + # erb :body, :layout => :layout do + # erb :foobar + # end + # end + # + # # foobar.erb + # <% content_for :one do %> + # + # <% end %> + # <% content_for :two do %> + # + # <% end %> + # + # Using <%= yield_content %> before <%= yield %> will cause only the second + # alert to display: + # + # # body.erb + # # Display only second alert + # <%= yield_content :one %> + # <%= yield %> + # <%= yield_content :two %> + # + # # body.erb + # # Display both alerts + # <%= yield %> + # <%= yield_content :one %> + # <%= yield_content :two %> + # module ContentFor include Capture