OSDN Git Service

* [shogi-server]
[shogi-server/shogi-server.git] / mk_html
diff --git a/mk_html b/mk_html
index bc4a5bf..6f32df8 100755 (executable)
--- a/mk_html
+++ b/mk_html
@@ -1,8 +1,10 @@
 #!/usr/bin/ruby
 # $Id$
 #
-# = Copyright
+# Author:: Daigo Moriwaki
+# Homepage:: http://sourceforge.jp/projects/shogi-server/
 #
+#--
 # Copyright (C) 2006-2008 Daigo Moriwaki <daigo at debian dot org>
 #
 # This program is free software; you can redistribute it and/or modify
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#++
 #
-# = Synopsis
+# == Synopsis
 #
-# mk_html generates an html page from players.yaml.
+# mk_html generates an html page from players.yaml.
 #
-# = Usage
+# == Usage
 #
-#   ./mk_html [OPTION] < players.yaml > rating.html
+# ./mk_html [OPTION] < players.yaml > rating.html
 #
 # -h, --help::
 #    show help
 # -w,--wdoor::
 #    adpot wdoor style
 #
+# == PREREQUIRE
+#
+# * Ruby 1.8.7 and RDoc
+#
+#   $ sudo aptitude install ruby1.8 rdoc1.8
+#
 
 require 'optparse'
 require 'rdoc/usage'
@@ -42,7 +51,14 @@ require 'erb'
 include ERB::Util
 
 def show_date(time)
-  time.strftime("%Y-%m-%d")
+  if (Time.now - time < 30*60)
+    return "on line"
+  elsif (Time.now - time < 24*60*60)
+    return time.strftime("%Y-%m-%d")
+    # return "%d hours ago" % [(Time.now - time)/3600]
+  else
+    return time.strftime("%Y-%m-%d")
+  end
 end
 
 def usage
@@ -136,7 +152,7 @@ def main
   %>
   <tr class="<%=player_decoration%>">
     <td class="name">
-        <a id="popup<%=popup_id+=1%>" href="http://wdoor.c.u-tokyo.ac.jp/shogi/tools/view/show-player.cgi?event=LATEST&amp;filter=floodgate&amp;show_self_play=1&amp;user=<%= h yaml[key]['name'] %>"><%= h yaml[key]['name'] %></a>
+        <a id="popup<%=popup_id+=1%>" href="http://wdoor.c.u-tokyo.ac.jp/shogi/tools/view/show-player.cgi?event=LATEST&amp;filter=floodgate&amp;show_self_play=1&amp;user=<%=u key%>"><%= h yaml[key]['name'] %></a>
         <script type="text/javascript">
           var tooltip<%=popup_id%> = new YAHOO.widget.Tooltip("myTooltip", {
             context:"popup<%=popup_id%>",
@@ -205,8 +221,8 @@ __END__
     .rate, .ngames, .win_rate {text-align: right;}
     .last_modified {text-align: center;}
     .gps, .yowai_gps {background-color: lightgreen;}
-    .current   {background-color: #FFFF00;}
-    .today     {background-color: #FFFF77;}
+    .current   {background-color: #FFD700;}
+    .today     {background-color: #FFFF00;}
     .this_week {background-color: #FFFFAA;}
 
     #bd {text-align: center;}