<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -55,7 +55,6 @@ module Publishing::Content
   # * :nothing  - Like Rail's render :nothing =&gt; true. Supplies empty layout and main_content buffers
   #
   # === See: 
-  # * PublishingLayoutAndTemplateFinder
   # * PublishingFilter
   # * LoggingSupport
   # * PublishingGlobalHelpers
@@ -83,22 +82,23 @@ module Publishing::Content
     #
     # Happens when an exception is raised during template rendering
     class TemplateError &lt; RuntimeError; end
-
+    
     include \
-      Publishing::LayoutAndTemplateFinder,
       Publishing::Filter::Execution,
-      Publishing::Render::Erb,
-      LoggingSupport,
-      TypefaceSharedHelper
+      LoggingSupport
     
-    attr_reader :session
+    attr_reader \
+      :session, 
+      :rendering_buffer, 
+      :rendered, 
+      :render_system,
+      :layout_stack
 
     delegate \
       :filters_for, 
       :filters, 
       :to =&gt; :publishing_format
     delegate \
-      :template_extension, 
       :publishing_format, 
       :content_stack, 
       :template_root, 
@@ -109,16 +109,138 @@ module Publishing::Content
       :using, 
       :log, 
       :to =&gt; :session
+      
+    module Delegator
+      delegate \
+        :log,
+        :using, 
+        :content,
+        :session,
+        :storage,
+        :rendering_buffer,
+        :to =&gt; :processor
+     
+      def processor
+        @processor
+      end
+      
+      def processor=(item)
+        @processor = item
+      end
+     
+      def execute(template)
+        send template.method, template.locals do |section, *stuff|
+          rendering_buffer[section].join
+        end
+      end
+    end
 
     # Initialize the rendering process passing a content instance and publishing format instance 
     def initialize(session)
-      setup_render_subsystem
+      @rendered = Set.new
+      @rendering_buffer  = Hash.new { |hash, key| hash[key] = Array.new }
       @session = session
+      @layout_stack = [ ]
+      @render_system = ActionView::Base.new
+      layout_stack &lt;&lt; template_root
+      update_view_paths
       # Add defined rendering methods
-      for helper in publishing_format.helpers
+      for helper in publishing_format.helpers + [ TypefaceSharedHelper ]
         helper  = Module.for helper unless helper.is_a? Module
+        # Use dynamically written proxy so instance vars are shared
         extend helper
+        proxy = Module.new
+        proxy.module_eval do
+          with_options :to =&gt; :processor do |forward|
+            forward.delegate *helper.public_instance_methods
+          end
+        end
+        render_system.extend proxy
       end
+      render_system.extend Delegator
+      render_system.processor = self
+    end
+
+    # Render, wrapping filters round before and after if any are registered
+    def render(options = {})
+      target = options[:target]
+      target_section = target if target.is_a? Symbol
+      target_section = :main_content if target.nil?
+      return render_without_filters(options) unless target_section # We don't wanna call this twice? (constructor calls non section filters)
+      process_with_filters content, target_section do 
+        generated_content = render_without_filters options
+      end
+    end
+    
+    # Do the process of rendering, without worrying about filters
+    # 
+    # This is where the nuts and bolts of rendering logic goes
+    def render_without_filters(options = {})
+      debug_message &quot;Rendering #{options.to_yaml}&quot;
+      target, template_name, layout, text, scope, nothing, inline = 
+        options.values_at :target, :template, :layout, :text, :scope, :nothing, :inline
+      # Default template name from content class
+      template_name ||= content.identity.to_s
+      # Default to the main content if target no specified
+      target ||= :main_content
+      # Can not double render the same section twice
+      # raise DoubleRenderError, &quot;You are attempting to render #{target} more than once&quot; if rendered? target
+      # Find our render source and then generate the rendered content
+      generated_content = case 
+      when nothing
+        @rendered &lt;&lt; target
+        nil
+      when text
+        text.to_s
+      when inline
+        render_system.render :inline =&gt; inline
+      when template_name
+        render_system.render template_name
+      end
+      # Find out what we do with our rendered content
+      case target
+      when :string
+        # Return the generated data
+        return generated_content
+      when String
+        # Write the generated data to our storage target
+        storage.write_file target, generated_content
+      when Symbol
+        # Add to buffer
+        rendering_buffer[target] &lt;&lt; generated_content
+      end
+    end
+    
+    # Ask is if a given template section has been rendered
+    def rendered?(target = :main_content)
+      !rendering_buffer[target].empty? or @rendered.include? target
+    end
+
+    # Empty rendering.
+    def render_nothing
+      render :nothing =&gt; true
+      render :nothing =&gt; true, :target =&gt; :layout
+      end
+    
+    # Call as a block to add additional layout sub directories in the search path
+    def using_layout(*list, &amp;code)
+      old_layouts = layout_stack.dup
+      begin
+        items = list.collect do |item|
+          File.join layout_stack.first, item
+        end
+        layout_stack.replace layout_stack + items
+        update_view_paths
+        code.call
+      ensure
+        layout_stack.replace old_layouts
+        update_view_paths
+      end
+    end
+    
+    # Tell render system (ActionView) to re investigate the paths
+    def update_view_paths
+      render_system.finder.view_paths = layout_stack
     end
   end
 end</diff>
      <filename>lib/publishing/content/render.rb</filename>
    </modified>
    <modified>
      <diff>@@ -151,8 +151,9 @@ class Publishing::Format
   # See Publishing::Format.define method
   def initialize(name, package_name)
     # Set up defaults
-    @content_removal_mapping  = Hash.new { |hash, key| hash[key] = Array.new }
-    @content_render_mapping   = Hash.new { |hash, key| hash[key] = Array.new }
+    mapping = Hash.new { |hash, key| hash[key] = Array.new }
+    @content_removal_mapping  = mapping.dup
+    @content_render_mapping   = mapping.dup
     @package_name             = package_name
     @tasks_module             = Module.new
     @areas_module             = Module.new</diff>
      <filename>lib/publishing/format.rb</filename>
    </modified>
    <modified>
      <diff>@@ -43,7 +43,9 @@ module TypefaceSharedHelper
 
   # Override the Rail's content_for as we have our own buffer system
   def content_for(area_name, &amp;content_code)
-    rendering_buffer[area_name] &lt;&lt; capture(&amp;content_code)
+    returning rendering_buffer[area_name] do |buffer|
+      buffer &lt;&lt; capture(&amp;content_code) if content_code
+    end
   end
   
   # Shortcut method for config</diff>
      <filename>lib/publishing/helpers/typeface_shared_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -48,7 +48,6 @@ class Publishing::Session
     :before_publishing_list, 
     :after_publishing_list, 
     :upon_publishing_list, 
-    :template_extension, 
     :publishing_format, 
     :content_folder,
     :template_root, 
@@ -249,12 +248,6 @@ class &lt;&lt; Publishing::Session
   def during_publishing(*method_list, &amp;code)
     append_tasks_to upon_publishing_list, method_list, &amp;code
   end
-
-  # Extension for template files, normally 'erb'
-  def template_extension(text = nil)
-    @template_extension = text if text
-    @template_extension || 'erb'
-  end
   
   # Pass a parameter to define a root template folder, otherwise this 
   # will default to the name of this format under ./vendor folder</diff>
      <filename>lib/publishing/session.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>lib/publishing/helpers/common_helper.rb</filename>
    </removed>
    <removed>
      <filename>lib/publishing/layout_and_template_finder.rb</filename>
    </removed>
    <removed>
      <filename>lib/publishing/render/erb.rb</filename>
    </removed>
    <removed>
      <filename>spec/lib/publishing_removal_spec.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>6b60ec70949c8e1473f47052dca7cb730711deb4</id>
    </parent>
  </parents>
  <author>
    <name>Jase</name>
    <email>jase@jase-laptop.(none)</email>
  </author>
  <url>http://github.com/virtualfunction/typeface/commit/eeca4aab9ee96fd2c546cdc9a4425dcd2e6b8ba6</url>
  <id>eeca4aab9ee96fd2c546cdc9a4425dcd2e6b8ba6</id>
  <committed-date>2008-08-29T02:42:14-07:00</committed-date>
  <authored-date>2008-08-29T02:42:14-07:00</authored-date>
  <message>Moving render system to use ActionView</message>
  <tree>3ca6b591ed59271cac33bb504b563da4a480979c</tree>
  <committer>
    <name>Jase</name>
    <email>jase@jase-laptop.(none)</email>
  </committer>
</commit>
