<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,4 @@
-%w(rubygems sinatra haml hpricot springnote).each{|lib| require lib}
+%w(rubygems sinatra haml springnote).each{|lib| require lib}
 
 before do
   @springnote = SpringnoteStore.new
@@ -11,24 +11,40 @@ end
 
 get '/items.atom' do
   header 'Content-Type' =&gt; 'application/atom+xml; charset=utf-8'
-  
-  @items = @springnote.items(1)[1..-1]
+
+  @items = @springnote.entries(1)
   haml :atom, :layout =&gt; false
 end
 
+get '/items/:pid' do
+  @items = [@springnote.item_by_id(params[:pid])]
+  haml :index
+end
+
 get '/items/:pid/:itemid' do
   @item = @springnote.item_by_id(params[:pid])
-  @contents = Hpricot(@item.source.to_s).search(&quot;#item_#{params[:itemid]}&quot;).html
+  @contents = @item.extract_entry(params[:itemid])
+  redirect &quot;/items/#{params[:pid]}&quot; if @contents.to_s.length &lt;= 0
   haml :single
 end
 
+get '/search' do
+  @items = @springnote.search(params[:q].to_s)
+  haml :index
+end
+
 get '/write' do
+  @author_name     = request.cookies['an'].to_s
+  @author_homepage = request.cookies['ah'].to_s
   haml :write
 end
 
 post '/write' do
   throw(:halt, [401, 'go away!']) if params[:email].to_s.length &gt; 0 || params[:contents].to_s.length &gt; 0 # to prevent spams
   
+  set_cookie 'an', params[:rref].to_s
+  set_cookie 'ah', params[:rres].to_s
+  
   @springnote.write params[:rref].to_s, params[:rres].to_s, params[:rree].to_s if params[:rref].to_s.length &gt; 0 &amp;&amp; params[:rree].to_s.length &gt; 0
   redirect '/'
 end</diff>
      <filename>hotruby.rb</filename>
    </modified>
    <modified>
      <diff>@@ -31,7 +31,8 @@ h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;}
 h6 {font-size:1em;font-weight:bold;}
 h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;}
 p {margin:0 0 1.5em;}
-p img {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;}
+p img {margin:1.5em 1.5em 1.5em 0;padding:0;}
+p img.left {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;}
 p img.right {float:right;margin:1.5em 0 1.5em 1.5em;}
 a:focus, a:hover {color:#000;}
 a {color:#009;text-decoration:underline;}
@@ -261,4 +262,5 @@ label { display:block;}
 .item_container {padding-bottom: 15px;}
 .item_meta {color: #999999; margin-left:7em; text-align:right;}
 .newdate { margin-left:-2em; }
-#header h1 { background:url(http://www.ruby-assn.org/ruby-logo2.png) no-repeat left top; padding-left:50px;}
\ No newline at end of file
+#header h1 { background:url(http://www.ruby-assn.org/ruby-logo2.png) no-repeat left top; padding-left:50px;}
+.newdate a {text-decoration:none; color:black;}
\ No newline at end of file</diff>
      <filename>public/stylesheets/screen.css</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,5 @@
-%w(springnote_client).each{|lib| require lib}
-
+%w(hpricot springnote_client).each{|lib| require lib}
+     
 class SpringnoteStore
   APP_KEY = 'a7501dcb75519aec11a7049e62e3a0f533c265bb'
   ITEM_PER_PAGE = 7
@@ -25,12 +25,17 @@ class SpringnoteStore
     pids = index_array[s...e].map{|v| v[1].to_i}.uniq
     [*@note.pages.find(*pids)].sort{|x, y| y.title &lt;=&gt; x.title}
   end
+    
+  def entries(page = 1)
+    items(page).map{|page| page.entries}.flatten
+  end
   
-  def write(name, homepage, contents)
-    target = today_page
+  def search(query)
+    []
+  end
     
-    target.source = item_html(name, homepage, contents, target) + target.source.to_s
-    target.save
+  def write(name, homepage, contents)
+    today_page.append_entry(name, homepage, contents)
   end
   
 protected
@@ -57,31 +62,20 @@ protected
     meta_pages.select{|page| page.identifier == pid}[0]
   end
   
+  def index_page
+    meta_page(config('index_page'))
+  end
+    
   def index_array
-    indexes.to_a.sort{|x, y| y[0] &lt;=&gt; x[0]}
+    index_hash.to_a.sort{|x, y| y[0] &lt;=&gt; x[0]}
   end
   
-  def indexes
-    return @indexes if @indexes
-    
-    @indexes = {}
-    meta_page(config('index_page')).source.to_s.
-      scan(/&lt;li&gt;.*?&lt;a.*?href=\&quot;\/pages\/(\d+)\&quot;.*?&gt;(.*?)&lt;\/a&gt;.*?&lt;\/li&gt;/mi).
-      map do |m|
-        @indexes[m[1].to_s] = m[0].to_i
-      end
-          
-    @indexes
+  def index_hash
+    @index_hash ||= index_page.to_index_hash
   end
   
-  def update_index
-    cont = index_array.map do |v|
-      %Q[&lt;li&gt;&lt;a href=&quot;/pages/#{v[1]}&quot;&gt;#{v[0]}&lt;/a&gt;]
-    end.join(&quot;\n&quot;)
-            
-    page = meta_page(config('index_page'))
-    page.source = &quot;&lt;ul&gt;#{cont}&lt;/ul&gt;&quot;
-    page.save
+  def update_index            
+    page = index_page.save_index(index_array)
   end
   
   
@@ -90,24 +84,73 @@ protected
   
   def today_page
     key = Time.now.strftime('%Y-%m-%d')
-    (indexes[key] &amp;&amp; @note.pages.find(indexes[key])) || create_page(key)
+    (index_hash[key] &amp;&amp; @note.pages.find(index_hash[key])) || create_page(key)
   end
   
   def create_page(key)
     page = @note.pages.build(:title =&gt; key, :relation_is_part_of =&gt; config('index_page'))
     page.save
     
-    @indexes[key] = page.identifier
+    @index_hash[key] = page.identifier
     update_index
     
     page
   end
+end
+
+
+class Springnote::Page
+  def parsed
+    @parsed ||= Hpricot(self.source.to_s)
+  end
+  
+  ################################
+  # For Entry Page
+  
+  def extract_entry(entry_id)
+    parsed.search(&quot;#item_#{entry_id}&quot;).html
+  end
+  
+  def entries
+    parsed.search('.item_container').map do |container|
+      {
+        :identifier =&gt; container.attributes['id'].split('_')[1].to_s,
+        :title =&gt;  container.search('.item_meta').text.split(' - ')[0].to_s,
+        :source =&gt; container.search('.item_body').html,
+        :page_id =&gt; self.identifier
+      }
+    end
+  end
+  
+  def append_entry(name, homepage, contents)
+    self.source = entry_html(name, homepage, contents) + self.source.to_s
+    save
+  end
+  
+  ################################
+  # For Index Page  
   
-  def item_html(name, homepage, contents, target)
+  def save_index(ary)
+    self.source = index_html(ary)
+    save
+  end
+  
+  def to_index_hash
+    ret = {}
+    self.source.to_s.
+      scan(/&lt;li&gt;.*?&lt;a.*?href=\&quot;\/pages\/(\d+)\&quot;.*?&gt;(.*?)&lt;\/a&gt;.*?&lt;\/li&gt;/mi).
+      map do |m|
+        ret[m[1].to_s] = m[0].to_i
+      end
+    ret
+  end
+  
+protected
+  def entry_html(name, homepage, contents)
     now = Time.now
     idstr = now.to_i.to_s
-    permlink = &quot;/items/#{target.identifier}/#{idstr}&quot;
-    
+    permlink = &quot;/items/#{self.identifier}/#{idstr}&quot;
+  
     &lt;&lt;-END
       &lt;div id=&quot;item_#{idstr}&quot; class=&quot;item_container&quot;&gt;
         &lt;div class=&quot;item_body&quot;&gt;#{contents}&lt;/div&gt;
@@ -118,4 +161,12 @@ protected
       &lt;/div&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;
     END
   end
-end
\ No newline at end of file
+  
+  def index_html(ary)
+    cont = ary.map do |v|
+      %Q[&lt;li&gt;&lt;a href=&quot;/pages/#{v[1]}&quot;&gt;#{v[0]}&lt;/a&gt;]
+    end.join(&quot;\n&quot;)
+            
+    &quot;&lt;ul&gt;#{cont}&lt;/ul&gt;&quot;
+  end
+end</diff>
      <filename>springnote.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,12 @@
 %feed{:xmlns =&gt; 'en-US', :xmlns =&gt; 'http://www.w3.org/2005/Atom'}
   %id HotRuby
-  %link{:type =&gt; 'text/html', :rel =&gt; 'alternate', :href =&gt; 'http://hot.rubykr.org'}
+  %link{:type =&gt; 'text/html', :rel =&gt; 'alternate', :href =&gt; 'http://hot.rubykr.org/'}
   %title &#46888;&#44144;&#50868; &#47336;&#48708; :: &#54632;&#44760; &#51204;&#54616;&#45716; &#47336;&#48708; &#45684;&#49828; 
+  %updated= Time.now.xmlschema
   
   - @items.each do |item|
     %entry
-      %id= &quot;HotRuby-#{item.identifier}&quot;
-      %title= &quot; &#46888;&#44144;&#50868; &#47336;&#48708; @ #{item.title}&quot;
-      %content{:type =&gt; 'html'}&amp;= item.source
\ No newline at end of file
+      %id= &quot;HotRuby-#{item[:identifier]}&quot;
+      %title= &quot; &#46888;&#44144;&#50868; &#47336;&#48708; #{item[:title]}&quot;
+      %link{:type =&gt; 'text/html', :rel =&gt; 'alternate', :href =&gt; &quot;http://hot.rubykr.org/items/#{item[:page_id]}/#{item[:identifier]}&quot;}
+      %content{:type =&gt; 'html'}&amp;= item[:source]
\ No newline at end of file</diff>
      <filename>views/atom.haml</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,8 @@
-- @items.each do |item|
-  %h3.newdate= item.title
-  .item
-    = item.source
\ No newline at end of file
+- if @items &amp;&amp; !@items.empty?
+  - @items.each do |item|
+    %h3.newdate
+      %a{:href =&gt; &quot;/items/#{item.identifier}&quot;}= item.title
+    .item
+      = item.source
+- else
+  &#50836;&#52397;&#54616;&#49888; &#45236;&#50857;&#51012; &#52286;&#51012; &#49688; &#50630;&#49845;&#45768;&#45796;.
\ No newline at end of file</diff>
      <filename>views/index.haml</filename>
    </modified>
    <modified>
      <diff>@@ -29,6 +29,28 @@
       #column.span-6.last
         #sidebar.box
           = sidebar
+        %script{:type =&gt; 'text/javascript', :src =&gt; 'http://disqus.com/forums/hotruby/combination_widget.js?num_items=3&amp;color=grey&amp;default_tab=recent'}
+        
+        %script{:type =&gt; 'text/javascript', :src =&gt; 'http://www.google.com/friendconnect/script/friendconnect.js'}
+        #div-1228789311065{:style =&gt; &quot;width:210px;border:1px solid #cccccc;&quot;}
+        
+        :javascript
+          var skin = {};
+          skin['HEIGHT'] = '385';
+          skin['BORDER_COLOR'] = '#cccccc';
+          skin['ENDCAP_BG_COLOR'] = '#e0ecff';
+          skin['ENDCAP_TEXT_COLOR'] = '#333333';
+          skin['ENDCAP_LINK_COLOR'] = '#0000cc';
+          skin['ALTERNATE_BG_COLOR'] = '#ffffff';
+          skin['CONTENT_BG_COLOR'] = '#ffffff';
+          skin['CONTENT_LINK_COLOR'] = '#0000cc';
+          skin['CONTENT_TEXT_COLOR'] = '#333333';
+          skin['CONTENT_SECONDARY_LINK_COLOR'] = '#7777cc';
+          skin['CONTENT_SECONDARY_TEXT_COLOR'] = '#666666';
+          skin['CONTENT_HEADLINE_COLOR'] = '#333333';
+          google.friendconnect.container.setParentUrl('/');
+          google.friendconnect.container.renderMembersGadget({ id: 'div-1228789311065', site: '13896217898592297465'}, skin);
+        
     #footer
       Developed by
       %a{:href =&gt; 'http://myruby.net/pages/1330384'} deepblue
@@ -52,4 +74,13 @@
       }
     }
     document.write('&lt;script type=&quot;text/javascript&quot; src=&quot;http://disqus.com/forums/hotruby/get_num_replies.js' + query + '&quot;&gt;&lt;/' + 'script&gt;');
-  })();
\ No newline at end of file
+  })();
+
+:javascript  
+  var gaJsHost = ((&quot;https:&quot; == document.location.protocol) ? &quot;https://ssl.&quot; : &quot;http://www.&quot;);
+  document.write(unescape(&quot;%3Cscript src='&quot; + gaJsHost + &quot;google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E&quot;));
+  
+:javascript  
+  var pageTracker = _gat._getTracker(&quot;UA-179536-4&quot;);
+  pageTracker._initData();
+  pageTracker._trackPageview();</diff>
      <filename>views/layout.haml</filename>
    </modified>
    <modified>
      <diff>@@ -8,10 +8,10 @@
     %textarea.hide{:type =&gt; 'text', :name =&gt; 'contents'}
 
     %label{:for =&gt; 'author_name'}&#51089;&#49457;&#51088; &#51060;&#47492;
-    %input#author_name.text{:type =&gt; 'text', :name =&gt; 'rref'}
+    %input#author_name.text{:type =&gt; 'text', :name =&gt; 'rref', :value =&gt; @author_name}
 
     %label{:for =&gt; 'author_homepage'}&#51089;&#49457;&#51088; &#54856;&#54168;&#51060;&#51648;
-    %input#author_homepage.text{:type =&gt; 'text', :name =&gt; 'rres'}
+    %input#author_homepage.text{:type =&gt; 'text', :name =&gt; 'rres', :value =&gt; @author_homepage}
 
     %label{:for =&gt; 'xqEditor'}&#45236;&#50857;
     %textarea#xqEditor.text{:type =&gt; 'text', :name =&gt; 'rree'}</diff>
      <filename>views/write.haml</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f4d00c705be9f4655d618fc4cfba33cf9951d2ac</id>
    </parent>
  </parents>
  <author>
    <name>deepblue</name>
    <email>deepblue@bluebox.local</email>
  </author>
  <url>http://github.com/deepblue/hotruby/commit/f7c00c13026382dfb63bf7d512bb2976bb256f18</url>
  <id>f7c00c13026382dfb63bf7d512bb2976bb256f18</id>
  <committed-date>2009-03-12T09:28:05-07:00</committed-date>
  <authored-date>2009-03-12T09:28:05-07:00</authored-date>
  <message>&#50500;&#51060;&#53596; &#54168;&#51060;&#51648;, &#53216;&#53412; &#51201;&#50857;</message>
  <tree>599ea7a3144e4e2d9f0a15d24d20f543f3896fb6</tree>
  <committer>
    <name>deepblue</name>
    <email>deepblue@bluebox.local</email>
  </committer>
</commit>
