<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3,11 +3,29 @@ module NestedLayoutTags
   
   class TagError &lt; StandardError; end
 
+  desc %{
+    Renders the contents of the tag inside of a &quot;parent&quot; layout, which is selected via the +name+
+    attribute.  The contents of this tag are placed at a corresponding &lt;r:content_for_layout/&gt; tag
+    within the parent layout.  This tag is intended to be used within your layouts, and should
+    only appear once per layout.
+    
+    *Usage:*
+
+    &lt;r:inside_layout name=&quot;master&quot;&gt;
+      &lt;div id=&quot;main-column&quot;&gt;
+        &lt;r:content_for_layout/&gt;
+      &lt;/div&gt;
+    &lt;/r:inside_layout&gt;
+    
+  }
   tag 'inside_layout' do |tag|
     if name = tag.attr['name']
       # Prepare the stacks
       tag.globals.nested_layouts_content_stack ||= []
       tag.globals.nested_layouts_layout_stack ||= []
+
+      # Remember the original layout to support the +layout+ tag
+      tag.globals.page_original_layout ||= tag.globals.page.layout # Remember the original layout
       
       # Find the layout
       name.strip!
@@ -31,11 +49,50 @@ module NestedLayoutTags
     end
   end
 
+  desc %{
+    Allows nested layouts to target this layout.  The contents of &lt;r:inside_layout&gt; tag blocks in another
+    layout will have their contents inserted at the location given by this tag (if they target this
+    layout).  This tag also behaves like a standard &lt;r:content/&gt; tag if this layout is specified directly
+    by a page.
+    
+    This tag is intended to be used inside layouts.
+    
+    *Usage:*
+
+    &lt;html&gt;
+      &lt;body&gt;
+        &lt;r:content_for_layout/&gt;
+      &lt;/body&gt;
+    &lt;/html&gt;
+    
+  }
   tag 'content_for_layout' do |tag|
     tag.globals.nested_layouts_content_stack ||= []
     
     # return the saved content if any, or mimic a default +&lt;r:content/&gt;+ tag (render the body part)
     tag.globals.nested_layouts_content_stack.pop || tag.globals.page.render_snippet(tag.locals.page.part('body'))
   end
-
+  
+  desc %{
+    Return the layout name of the current page.
+    
+    *Usage:*
+    
+    &lt;html&gt;
+      &lt;body id=&quot;&lt;r:layout/&gt;&quot;
+        My body tag has an id corresponding to the layout I use.  Sweet!
+      &lt;/body&gt;
+    &lt;/html&gt;
+  }
+  tag 'layout' do |tag|
+    if layout = tag.globals.page_original_layout
+      layout.name
+    else
+      if layout = tag.globals.page.layout
+        layout.name
+      else
+        ''
+      end
+    end
+  end
 end
\ No newline at end of file</diff>
      <filename>lib/nested_layout_tags.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,10 @@
 require File.dirname(__FILE__) + '/../spec_helper'
 
 describe &quot;Nested Layout Tags&quot; do
-  scenario :pages
-
   before :each do
     setup_page_and_layouts
   end
-  
+
   it 'should render without layout' do
     @page.layout = nil
     @page.render.should == 'Hello World!'
@@ -37,6 +35,27 @@ describe &quot;Nested Layout Tags&quot; do
     @page.render.should == %{&lt;html&gt;&lt;body&gt;&lt;div id=&quot;multiword&quot;&gt;&lt;div id=&quot;nested-multiword&quot;&gt;Hello World!&lt;/div&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;}
   end
   
+  context &quot;with &lt;r:layout/&gt; tags&quot; do
+    before(:each) do
+      @page.parts.first.content = &quot;&lt;r:layout/&gt;&quot;
+    end
+
+    it 'should render correctly for a traditional layout' do
+      @page.layout = @layouts[:traditional]
+      @page.render.should == %{&lt;html&gt;&lt;body&gt;traditional&lt;/body&gt;&lt;/html&gt;}
+    end
+
+    it 'should render correctly for a non-nested layout' do
+      @page.layout = @layouts[:master]
+      @page.render.should == %{&lt;html&gt;&lt;body&gt;master&lt;/body&gt;&lt;/html&gt;}
+    end
+    
+    it 'should render correctly for a nested layout' do
+      @page.layout = @layouts[:nest1]
+      @page.render.should == %{&lt;html&gt;&lt;body&gt;&lt;div id=&quot;nest1&quot;&gt;nest1&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;}
+    end
+    
+  end
 end
 
 def setup_page_and_layouts</diff>
      <filename>spec/models/nested_layout_tags_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>2eee1b26237874a6d015700525fec2016dcbc028</id>
    </parent>
  </parents>
  <author>
    <name>Michael Klett</name>
    <email>michael@webadvocate.com</email>
  </author>
  <url>http://github.com/moklett/radiant-nested-layouts-extension/commit/3307d0bbe1d361ced6dbc7a01e0e278b23a44526</url>
  <id>3307d0bbe1d361ced6dbc7a01e0e278b23a44526</id>
  <committed-date>2009-06-28T18:46:24-07:00</committed-date>
  <authored-date>2009-06-28T18:46:24-07:00</authored-date>
  <message>Added the &lt;r:layout/&gt; tag, and some inline docs (desc) for all tags.</message>
  <tree>00f95e46f289910c0ea1bfa3bd104113df18fe26</tree>
  <committer>
    <name>Michael Klett</name>
    <email>michael@webadvocate.com</email>
  </committer>
</commit>
