<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -63,9 +63,27 @@ module Liquid
     end
 
     # Sort elements of the array
-    def sort(input)
-      [input].flatten.sort
+    # provide optional property with which to sort an array of hashes or drops
+    def sort(input, property = nil)
+      ary = [input].flatten
+      if property.nil?
+        ary.sort
+      elsif ary.first.respond_to?('[]') and !ary.first[property].nil?
+        ary.sort {|a,b| a[property] &lt;=&gt; b[property] }
+      elsif ary.first.respond_to?(property)
+        ary.sort {|a,b| a.send(property) &lt;=&gt; b.send(property) }
+      end
     end               
+    
+    # map/collect on a given property
+    def map(input, property)
+      ary = [input].flatten
+      if ary.first.respond_to?('[]') and !ary.first[property].nil?
+        ary.map {|e| e[property] }
+      elsif ary.first.respond_to?(property)
+        ary.map {|e| e.send(property) }
+      end
+    end
             
     # Replace occurrences of a string with another
     def replace(input, string, replacement = '')</diff>
      <filename>lib/liquid/standardfilters.rb</filename>
    </modified>
    <modified>
      <diff>@@ -67,6 +67,13 @@ class StandardFiltersTest &lt; Test::Unit::TestCase
   
   def test_sort
     assert_equal [1,2,3,4], @filters.sort([4,3,2,1])    
+    assert_equal [{&quot;a&quot; =&gt; 1}, {&quot;a&quot; =&gt; 2}, {&quot;a&quot; =&gt; 3}, {&quot;a&quot; =&gt; 4}], @filters.sort([{&quot;a&quot; =&gt; 4}, {&quot;a&quot; =&gt; 3}, {&quot;a&quot; =&gt; 1}, {&quot;a&quot; =&gt; 2}], &quot;a&quot;)
+  end
+  
+  def test_map
+    assert_equal [1,2,3,4], @filters.map([{&quot;a&quot; =&gt; 1}, {&quot;a&quot; =&gt; 2}, {&quot;a&quot; =&gt; 3}, {&quot;a&quot; =&gt; 4}], 'a')
+    assert_template_result 'abc', &quot;{{ ary | map:'foo' | map:'bar' }}&quot;,
+      'ary' =&gt; [{'foo' =&gt; {'bar' =&gt; 'a'}}, {'foo' =&gt; {'bar' =&gt; 'b'}}, {'foo' =&gt; {'bar' =&gt; 'c'}}]
   end
   
   def test_date</diff>
      <filename>test/standard_filter_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>3d8efe04a743d6fb4c3bc8d198f630f9896b853e</id>
    </parent>
  </parents>
  <author>
    <name>James MacAulay</name>
    <email>james@jadedpixel.com</email>
  </author>
  <url>http://github.com/tobi/liquid/commit/36860eab570f448a7bc11875665f0642ed0e462d</url>
  <id>36860eab570f448a7bc11875665f0642ed0e462d</id>
  <committed-date>2008-10-28T07:36:05-07:00</committed-date>
  <authored-date>2008-10-28T07:36:05-07:00</authored-date>
  <message>added array sorting and mapping on properties</message>
  <tree>2dadd028ab800c8008c9cc8d11526d8d65c9c502</tree>
  <committer>
    <name>James MacAulay</name>
    <email>james@jadedpixel.com</email>
  </committer>
</commit>
