<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -26,7 +26,7 @@ class Notable::App &lt; Sinatra::Default
   end
 
   def format_note(note)
-    &quot;#{note.body} - &lt;em&gt;#{note.created_at.strftime('%H:%M')} #{note.created_at_to_s}&lt;/em&gt;&quot;
+    &quot;#{note.html_body} - &lt;em&gt;#{note.created_at.strftime('%H:%M')} #{note.created_at_to_s}&lt;/em&gt;&quot;
   end
 
   def choose_format</diff>
      <filename>lib/notable/app.rb</filename>
    </modified>
    <modified>
      <diff>@@ -23,5 +23,11 @@ module Notable
         created_at.strftime('%d %b')
       end
     end
+
+    def html_body
+      body.gsub(/((http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}((\:[0-9]{1,5})?\/?.*)?)/) do |match|
+        &quot;&lt;a href=\&quot;#{match}\&quot;&gt;#{match}&lt;/a&gt;&quot;
+      end
+    end
   end
 end</diff>
      <filename>lib/notable/note.rb</filename>
    </modified>
    <modified>
      <diff>@@ -130,7 +130,7 @@ describe &quot;Notable::App - Note Creation&quot; do
 
   describe &quot;post '/' with a body&quot; do
     before do
-      post '/', {}, :input =&gt; 'A new note!'
+      post '/', {}, :input =&gt; 'A new note! http://www.example.com'
     end
 
     it &quot;returns 201 Created&quot; do
@@ -150,6 +150,13 @@ describe &quot;Notable::App - Note Creation&quot; do
       parsed_body.at('//body//li').should.not.be.nil
       parsed_body.at('//body//li').inner_html.should.match(/^A new note!/)
     end
+
+    it &quot;converts a URL to a link&quot; do
+      get '/'
+      parsed_body.at('//body//li').at('a').should.not.be.nil
+      parsed_body.at('//body//li').at('a')[:href].should.equal 'http://www.example.com'
+      parsed_body.at('//body//li').at('a').inner_html.should.equal 'http://www.example.com'
+    end
   end
 
   describe &quot;post '/' without a valid note&quot; do
@@ -172,7 +179,9 @@ end
 describe &quot;With Some Notes&quot; do
   before do
     DataMapper.auto_migrate!
-    @notes = %w{bat cat dog dolphin giraffe pony}
+    @link = 'http://example.net'
+    @link_note = &quot;A test #{@link}&quot;
+    @notes =  %w{bat cat dog dolphin giraffe pony} + [@link_note]
     @notes.each_with_index do |n, i|
       Timecop.travel(2009, 3, 25, 10, 10, i) do
         post '/', :note =&gt; n
@@ -191,7 +200,7 @@ describe &quot;With Some Notes&quot; do
       end
 
       it &quot;should have all the items in a list&quot; do
-        parsed_body.search('//body//li').size.should.equal 6
+        parsed_body.search('//body//li').size.should.equal 7
       end
     end
 
@@ -207,8 +216,8 @@ describe &quot;With Some Notes&quot; do
       end
 
       it &quot;gets more than 5 when you ask for it&quot; do
-        get '/last/7'
-        parsed_body.search('//body//li').size.should.equal 6
+        get '/last/8'
+        parsed_body.search('//body//li').size.should.equal 7
       end
 
       it &quot;gets five when you give it a silly request&quot; do
@@ -246,7 +255,7 @@ describe &quot;With Some Notes&quot; do
       end
 
       it &quot;returns an array of the items&quot; do
-        parsed_json.size.should.equal 6
+        parsed_json.size.should.equal 7
       end
 
       it &quot;returns an array of hashes&quot; do
@@ -269,8 +278,8 @@ describe &quot;With Some Notes&quot; do
       end
 
       it &quot;gets more than 5 when you ask for it&quot; do
-        get_json '/last/7'
-        parsed_json.size.should.equal 6
+        get_json '/last/8'
+        parsed_json.size.should.equal 7
       end
 
       it &quot;gets five when you give it a silly request&quot; do
@@ -331,7 +340,7 @@ describe &quot;With Some Notes&quot; do
     end
 
     it &quot;has the correct number of items&quot; do
-      parsed_xml.search('/rss/channel/item').size.should.equal 6
+      parsed_xml.search('/rss/channel/item').size.should.equal 7
     end
 
     describe &quot;an item&quot; do
@@ -340,15 +349,15 @@ describe &quot;With Some Notes&quot; do
       end
 
       it &quot;has the correct title&quot; do
-        @item.at('/title[text()=&quot;pony&quot;]').should.not.be.nil
+        @item.at('/title').inner_html.should.equal @link_note
       end
 
-      it &quot;has the correct description&quot; do
-        @item.at('/description[text()=&quot;pony&quot;]').should.not.be.nil
+      it &quot;has the correct description, with html escaped.&quot; do
+        @item.at('/description').inner_html.should.equal %Q|A test &amp;lt;a href=&amp;quot;#{@link}&amp;quot;&amp;gt;#{@link}&amp;lt;/a&amp;gt;|
       end
 
       it &quot;has the correct timestamp&quot; do
-        @item.at('/pubDate').inner_html.should.equal(&quot;Wed, 25 Mar 2009 10:10:05 GMT&quot;)
+        @item.at('/pubDate').inner_html.should.equal(&quot;Wed, 25 Mar 2009 10:10:06 GMT&quot;)
       end
     end
   end</diff>
      <filename>spec/notable_app_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,6 +8,6 @@
     - @notes.each do |note|
       %item
         %title&amp;= note.body
-        %description&amp;= note.body
+        %description&amp;= note.html_body
         %pubDate= note.created_at.new_offset.strftime('%a, %d %b %Y %H:%M:%S GMT')
 </diff>
      <filename>views/rss.haml</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>2d2c4f65f8219de218e201737c4b1cb0d042090d</id>
    </parent>
  </parents>
  <author>
    <name>Jonathan Stott</name>
    <email>jonathan.stott@gmail.com</email>
  </author>
  <url>http://github.com/namelessjon/notable/commit/2b5a31d5fbb243833a02792132d216c0c6f77c4c</url>
  <id>2b5a31d5fbb243833a02792132d216c0c6f77c4c</id>
  <committed-date>2009-07-10T15:57:41-07:00</committed-date>
  <authored-date>2009-07-10T15:57:41-07:00</authored-date>
  <message>Convert urls in notes to links in html+feed</message>
  <tree>a4584728732b237c769973877af79beafc9cfdf9</tree>
  <committer>
    <name>Jonathan Stott</name>
    <email>jonathan.stott@gmail.com</email>
  </committer>
</commit>
