<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -2,5 +2,5 @@ template_location = File.join(File.dirname(__FILE__), 'views')
 Utype::Hooks::Views.register(:new_post_form_options_panel, template_location + '/formatter_select')
 
 Utype::App.after_components_init do
-  Post.is :formattable, :source_property =&gt; :body, :result_property =&gt; :body_html
-end
+  require File.dirname(__FILE__)+'/lib/post_extensions'
+end
\ No newline at end of file</diff>
      <filename>app/components/formatters/init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,7 @@
 class Post &lt; Content
-  has_liquid_properties :body_html, :full_permalink, :author
+  property :body_excerpt, Text
+  
+  has_liquid_properties :full_permalink, :full_body, :excerpt_html, :author
 
   before :save do
     self.permalink = self.title.gsub(' ', '-').downcase if self.permalink.blank?
@@ -13,6 +15,15 @@ class Post &lt; Content
     self.permalink
   end
   
+  def full_body
+    attribute_get(:body_excerpt).blank? ? 
+      attribute_get(:body) : &quot;#{attribute_get(:body_excerpt)}#{attribute_get(:body)}&quot;
+  end
+  
+  def excerpt_html
+    body_excerpt_html.blank? ? body_html : body_excerpt_html
+  end
+  
   def author
     self.user
   end</diff>
      <filename>app/components/publisher/models/post.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,6 +7,11 @@
     &lt;/p&gt;
   
     &lt;p class=&quot;watermark&quot;&gt;
+      &lt;label for=&quot;post_body_excerpt&quot;&gt;The excerpt of your post goes here. (&lt;a href=&quot;#&quot; id=&quot;excerpt_cancel&quot;&gt;cancel&lt;/a&gt;)&lt;/label&gt;
+      &lt;%= text_area :body_excerpt, :rows =&gt; 5, :cols =&gt; 80 %&gt;
+    &lt;/p&gt;
+  
+    &lt;p class=&quot;watermark&quot;&gt;
       &lt;label for=&quot;post_body&quot;&gt;The content of your post goes here.&lt;/label&gt;
       &lt;%= text_area :body, :rows =&gt; 10, :cols =&gt; 80 %&gt;
     &lt;/p&gt;</diff>
      <filename>app/components/publisher/views/admin/posts/_form.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@
 &lt;% @posts.each do |post| -%&gt;
   &lt;dl class=&quot;post&quot;&gt;
     &lt;dt&gt;&lt;%= post.title %&gt;&lt;/dt&gt;
-    &lt;dd class=&quot;body&quot;&gt;&lt;%= post.body_html %&gt;&lt;/dd&gt;
+    &lt;dd class=&quot;body&quot;&gt;&lt;%= post.body_excerpt_html.blank? ? post.body_html : post.body_excerpt_html %&gt;&lt;/dd&gt;
     &lt;dd class=&quot;post-actions&quot;&gt;
       &lt;h5 class=&quot;hidden&quot;&gt;Actions&lt;/h5&gt;
       &lt;ul&gt;</diff>
      <filename>app/components/publisher/views/admin/posts/index.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -5,77 +5,55 @@ module DataMapper
       FORMATTERS = [ :textile, :markdown ]
 
       ##
-      # fired when your plugin gets included into Resource
-      #
-      def self.included(base)
-
-      end
-
-      ##
       # Methods that should be included in DataMapper::Model.
       # Normally this should just be your generator, so that the namespace
       # does not get cluttered. ClassMethods and InstanceMethods gets added
       # in the specific resources when you fire is :formattable
       ##
-
       def is_formattable(options={})
         extend  DataMapper::Is::Formattable::ClassMethods
         include DataMapper::Is::Formattable::InstanceMethods
         
-        options = { 
-          :by  =&gt; :textile,
-          :format_property =&gt; :format_with, 
-          :source_property =&gt; :content_original, 
-          :result_property =&gt; :content_formatted 
+        @formattable_options = options = { 
+          :by =&gt; :textile,
+          :on =&gt; { :content_original =&gt; :content_formatted },
+          :format_property =&gt; :format_with
         }.merge!(options)
         
-        self.formattable_options = options
+        options[:on].each do |source, result|
+          property source, DataMapper::Types::Text
+          property result, DataMapper::Types::Text
+        end
         
-        property options[:source_property], DataMapper::Types::Text
-        property options[:result_property], DataMapper::Types::Text
-        property options[:format_property], DataMapper::Types::Enum[:textile, :markdown, :wikitext], 
+        property options[:format_property], DataMapper::Types::Enum[:textile, :markdown], 
           :nullable =&gt; false, :default =&gt; options[:by]
         
         before :save, :format_source!
       end
 
       module ClassMethods
-        attr_accessor :formattable_options
-        
-        def format_property
-          self.send(formattable_options[:format_property])
-        end
-        
-        def source_property
-          self.send(formattable_options[:source_property])
-        end
-        
-        def result_property
-          self.send(formattable_options[:result_property])
-        end
+        attr_reader :formattable_options
       end # ClassMethods
 
       module InstanceMethods
-        
         def format_source!
-          unless new_record? || dirty_attributes.keys.include?(self.class.source_property)
-            return
-          end
-          
           format = attribute_get(self.class.formattable_options[:format_property])
           
-          result = case format
-            when :textile:
-              RedCloth.new(attribute_get(self.class.formattable_options[:source_property])).to_html
-            when :markdown:
-              BlueCloth.new(attribute_get(self.class.formattable_options[:source_property])).to_html
-            else
-              raise Exception.new(&quot;Unknown format type: #{format}! Supported formatters are: #{FORMATTERS.join(', ')}&quot;)
-            end
+          self.class.formattable_options[:on].each do |source, result|
+            next unless self.dirty_attributes.map{|a, v| a.name}.include?(source)
+            
+            markup = case format
+              when :textile:
+                RedCloth.new(attribute_get(source)).to_html
+              when :markdown:
+                BlueCloth.new(attribute_get(source)).to_html
+              else
+                raise Exception.new(&quot;Unknown format type: #{format}! Supported formatters are: #{FORMATTERS.join(', ')}&quot;)
+              end
             
-          attribute_set(self.class.formattable_options[:result_property], result)
+            attribute_set(result, markup)
+          end
         end
-        
       end # InstanceMethods
 
     end # Formattable</diff>
      <filename>gems/gems/dm-is-formattable-0.1/lib/dm-is-formattable/is/formattable.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,7 +5,6 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
   describe 'DataMapper::Is::Formattable' do
     
     before :all do
-      
       class Page
         include DataMapper::Resource
         property :id, Serial
@@ -14,6 +13,24 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
         auto_migrate!
       end
       
+      class Page2
+        include DataMapper::Resource
+        property :id, Serial
+        is :formattable, :on =&gt; { :body_part =&gt; :body_part_html, :body =&gt; :body_html }, :format_property =&gt; :formatter
+        auto_migrate!
+      end
+    end
+    
+    it 'should set custom names for properties' do
+      page = Page2.new
+      
+      page.respond_to?(:formatter).should be(true)
+      page.respond_to?(:body).should be(true)
+      page.respond_to?(:body_html).should be(true)
+      
+      page.respond_to?(:formatter).should be(true)
+      page.respond_to?(:body_part).should be(true)
+      page.respond_to?(:body_part_html).should be(true)
     end
 
     it 'should format with textile by default' do
@@ -30,19 +47,17 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
       page.content_formatted.should eql('&lt;p&gt;&lt;strong&gt;strong text only&lt;/strong&gt;&lt;/p&gt;')
     end
     
-    it 'should set custom names for properties' do
-      class Page2
-        include DataMapper::Resource
-        property :id, Serial
-        is :formattable, :format_property =&gt; :formatter, :source_property =&gt; :body, :result_property =&gt; :body_html
+    describe 'with more then one source field' do
+      it 'should format all the source fields' do
+        page = Page2.new(
+          :body_part =&gt; '*strong text*',
+          :body      =&gt; '*strong text* and _emphasized text_'
+        )
+        page.save
+        
+        page.body_part_html.should eql('&lt;p&gt;&lt;strong&gt;strong text&lt;/strong&gt;&lt;/p&gt;')
+        page.body_html.should eql('&lt;p&gt;&lt;strong&gt;strong text&lt;/strong&gt; and &lt;em&gt;emphasized text&lt;/em&gt;&lt;/p&gt;')
       end
-      
-      page = Page2.new
-      
-      page.respond_to?(:formatter).should be(true)
-      page.respond_to?(:body).should be(true)
-      page.respond_to?(:body_html).should be(true)
     end
-    
   end
 end</diff>
      <filename>gems/gems/dm-is-formattable-0.1/spec/integration/formattable_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
 
   s.required_rubygems_version = Gem::Requirement.new(&quot;&gt;= 0&quot;) if s.respond_to? :required_rubygems_version=
   s.authors = [&quot;Piotr Solnica&quot;]
-  s.date = %q{2008-11-02}
+  s.date = %q{2008-11-08}
   s.description = %q{Formatting engines support for DataMapper}
   s.email = [&quot;piotr [a] zenbe [d] com&quot;]
   s.extra_rdoc_files = [&quot;README.txt&quot;, &quot;LICENSE&quot;, &quot;TODO&quot;]</diff>
      <filename>gems/specifications/dm-is-formattable-0.1.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -23,7 +23,9 @@ module Utype
         if self.base_model == self
           @liquid_properties = *args.flatten
         else
-          @liquid_properties = [*args].concat(self.base_model.liquid_properties).flatten.uniq
+          @liquid_properties ||= []
+          @liquid_properties = [*args].concat(
+            self.base_model.liquid_properties).concat(self.liquid_properties).flatten.uniq
         end
       end
     end</diff>
      <filename>lib/utype.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>248ac2fa8be9b626d8a20480c37a375559527ea8</id>
    </parent>
  </parents>
  <author>
    <name>solnic</name>
    <email>piotr@zenbe.com</email>
  </author>
  <url>http://github.com/mariusz/utype/commit/d1d5ff9b6d46b57b03495b0d4b73f1a3a2208f26</url>
  <id>d1d5ff9b6d46b57b03495b0d4b73f1a3a2208f26</id>
  <committed-date>2008-11-08T05:29:35-08:00</committed-date>
  <authored-date>2008-11-08T05:29:35-08:00</authored-date>
  <message>updated dm-is-formattable</message>
  <tree>009697c4957bf1b1cb89876f1abe4cffc1cc49df</tree>
  <committer>
    <name>solnic</name>
    <email>piotr@zenbe.com</email>
  </committer>
</commit>
