<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>spec/models/tag_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,4 @@
 class Tag &lt; ActiveRecord::Base
-  @@tag_parse_regex = /((?: |)['&quot;]{0,1})['&quot;]?\s*(.*?)\s*(?:[,'&quot;]|$)(?:\1(?: |$))/
   has_many :taggings
 
   class &lt;&lt; self
@@ -7,23 +6,19 @@ class Tag &lt; ActiveRecord::Base
       find_by_name(tag.to_s)
     end
 
-    # parses a comma separated list of tags into tag names
-    # handles all kinds of different tags. (comma seperated, space seperated (in quotation marks))
-    # should handle most the common keyword formats.
-    #
-    # e.g.: b'log, emacs fun, rails, ruby =&gt; &quot;b'log&quot;, &quot;emacs fun&quot;, &quot;rails&quot;, &quot;ruby&quot;
-    #       &quot;b'log&quot; &quot;emacs fun&quot; &quot;rails&quot; &quot;ruby&quot; =&gt; &quot;b'log&quot;, &quot;emacs fun&quot;, &quot;rails&quot;, &quot;ruby&quot;
-    #       'b\'log' 'emacs fun' 'rails' 'ruby' =&gt; &quot;b'log&quot;, &quot;emacs fun&quot;, &quot;rails&quot;, &quot;ruby&quot;
+    # parses a list of tags into tag names
     #
     #   Tag.parse('a, b, c')
     #   # =&gt; ['a', 'b', 'c']
+    #
+    #   Tag.parse(&quot;a b c&quot;)
+    #   # =&gt; ['a', 'b', 'c']
+    #
+    #   Tag.parse(%(a &quot;b c&quot;))
+    #   # =&gt; ['a', 'b c']
     def parse(list)
       return list if list.is_a?(Array)
-      returning list.scan(@@tag_parse_regex) do |tags|
-        tags.collect! { |t| t.last.strip!; t.last }
-        tags.uniq!
-        tags.delete_if &amp;:blank?
-      end
+      list.include?(',') ? parse_with_commas(list) : parse_with_spaces(list)
     end
 
     # Parses comma separated tag list and returns tags for them.
@@ -44,6 +39,38 @@ class Tag &lt; ActiveRecord::Base
         found_tags + (tag_names - found_tags.collect(&amp;:name)).collect { |s| create!(:name =&gt; s) }
       end
     end
+  
+    private
+      def parse_with_commas(list)
+        cleanup_tags(list.split(','))
+      end
+      
+      def parse_with_spaces(list)
+        tags = []
+
+        # first, pull out the quoted tags
+        list.gsub!(/\&quot;(.*?)\&quot;\s*/ ) { tags &lt;&lt; $1; &quot;&quot; }
+        
+        # then, get whatever's left
+        tags.concat list.split(/\s/)
+
+        cleanup_tags(tags)
+      end
+    
+      def cleanup_tags(tags)
+        tags.tap do |t|
+          t.collect! do |tag|
+            unless tag.blank?
+              tag.downcase!
+              tag.gsub!(/:/, '')
+              tag.strip!
+              tag
+            end
+          end
+          t.compact!
+          t.uniq!
+        end
+      end
   end
 
   def ==(comparison_object)</diff>
      <filename>app/models/tag.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>test/unit/tag_test.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>dd9dab0acec75dcdbaad92a5340b435f7c96464f</id>
    </parent>
  </parents>
  <author>
    <name>technoweenie</name>
    <email>technoweenie@567b1171-46fb-0310-a4c9-b4bef9110e78</email>
  </author>
  <url>http://github.com/francois/mephisto/commit/f1f452cedb159e01353c5da6dcd2015d973a6189</url>
  <id>f1f452cedb159e01353c5da6dcd2015d973a6189</id>
  <committed-date>2007-11-23T21:00:41-08:00</committed-date>
  <authored-date>2007-11-23T21:00:41-08:00</authored-date>
  <message>allow space AND comma delimited tags

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@3055 567b1171-46fb-0310-a4c9-b4bef9110e78</message>
  <tree>ca50ea5db121657d700cd09c69e028c15fa1490f</tree>
  <committer>
    <name>technoweenie</name>
    <email>technoweenie@567b1171-46fb-0310-a4c9-b4bef9110e78</email>
  </committer>
</commit>
