Index: 01css.rb
===================================================================
RCS file: 01css.rb
diff -N 01css.rb
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ 01css.rb	12 Dec 2003 16:56:44 -0000
@@ -0,0 +1,12 @@
+css_tag = method(:css_tag)
+new = proc do
+  css = css_tag.call
+  if @theme and !@theme.empty? and @css and !@css.empty?
+    title = CGI::escapeHTML(File::basename(@css, '.css'))
+    css.sub!(/^\s*(?=.*\Z)/, %[\\&<link rel="stylesheet" href="#{@css}" type="text/css" media="all">\n\\&])
+  end
+  css
+end
+class << self; self; end.module_eval do
+  define_method(:css_tag, new)
+end
Index: abbr.rb
===================================================================
RCS file: abbr.rb
diff -N abbr.rb
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ abbr.rb	12 Dec 2003 16:56:44 -0000
@@ -0,0 +1,7 @@
+def abbr(body, title = nil)
+  body, title = body.split(/\|/, 2) unless title
+  tag = $1 if /\`(.*)\'/ =~ caller(0)[0]
+  %[<#{tag} title="#{CGI::escapeHTML(title)}">#{body}</#{tag}>]
+end
+
+alias acronym abbr
Index: alt-theme.rb
===================================================================
RCS file: alt-theme.rb
diff -N alt-theme.rb
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ alt-theme.rb	12 Dec 2003 16:56:44 -0000
@@ -0,0 +1,99 @@
+css_tag = method(:css_tag)
+new = proc do
+  max = @conf['themes.max'].to_i.nonzero? || 10
+  mix = @conf['themes.mix'].to_i
+  themes = @conf['themes.list']
+  themes = themes ? themes.split : []
+  css = [css_tag.call.chomp]
+
+  alt = "alternative "
+  sty = nil
+  altthemes = []
+  if @theme and !@theme.empty? then
+    themes.delete(@theme)
+    max -= 1
+  else
+    mix += 1
+  end
+  max.times do
+    theme = themes.delete_at(rand(themes.size)) or break
+    title = CGI::escapeHTML(theme)
+    altthemes << title
+    if mix > 0
+      mix -= 1
+    else
+      sty = alt
+    end
+    css << %[<link rel="#{sty}stylesheet" href="#{theme_url}/#{theme}/#{theme}.css" title="#{title}" type="text/css" media="all">]
+  end
+  @alt_themes = altthemes
+
+  css.join("\n\t") << "\n"
+end
+class << self; self; end.module_eval do
+  define_method(:css_tag, new)
+end
+
+texts = {}
+texts['en'] = {
+  'themes' => 'alternative themes',
+  'list' => '<h3>Using themes</h3>
+<p>Check themes which you want to use as alternatives.</p>
+',
+  'max' => '<h3>Maximum themes</h3>
+<p>Note that browsers may try to load all stylesheets at once.</p>
+',
+  'mix' => '<h3>Mixing themes</h3>
+<p>Number of mixing themes.</p>
+',
+}
+texts['ja'] = {
+  'themes' => '代替テーマ',
+  'list' => '<h3>使用テーマ</h3>
+<p>代替として使いたいテーマをチェックしてください。</p>
+',
+  'max' => '<h3>テーマ最大数</h3>
+<p>ブラウザがすべてのスタイルシートを一度にロードしようとするかも知れないので注意。</p>
+',
+  'mix' => '<h3>混合テーマ数</h3>
+<p>混ぜるテーマの数。</p>
+',
+}
+
+texts.default = texts['ja']
+gettext = proc do |text|
+  texts[@lang].fetch(text) {text}
+end
+
+add_conf_proc('themes', gettext['themes']) do
+  if /^(?:save)?conf$/ =~ @mode
+    %w[max mix].each do |par|
+      par = "themes.#{par}"
+      val = @cgi.params[par][0] and @conf[par] = val.to_i
+    end
+    %w[list].each do |par|
+      par = "themes.#{par}"
+      val = @cgi.params[par] and val.empty? or @conf[par] = val.join(" ")
+    end
+  end
+  max = @conf['themes.max']
+  mix = @conf['themes.mix']
+  list = @conf['themes.list']
+  list = list ? list.split : []
+  r = []
+  %w[max mix].each do |par|
+    par = "themes.#{par}"
+    val = @conf[par]
+    r << gettext[par]
+    r << %[<p><input name="#{par}" size="2" value="#{val}"</p>]
+  end
+  r << gettext['list']
+  r << '<table>'
+  @conf_theme_list.each_with_index do |(theme, name), i|
+    r << '</tr><tr>' if i % 5 == 0
+    r << %[<td><input type="checkbox" name="themes.list"#{list.include?(theme) ? ' checked': ''} value="#{theme}">#{name}</td>]
+  end
+  r << '</tr>'
+  r << '</table>'
+  r.join("\n")
+end
Index: calendar3.js
===================================================================
RCS file: calendar3.js
diff -N calendar3.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ calendar3.js	12 Dec 2003 16:56:44 -0000
@@ -0,0 +1,107 @@
+// http://www.din.or.jp/~hagi3/JavaScript/JSTips/Mozilla/
+// _dom : kind of DOM.
+//        IE4 = 1, IE5+ = 2, NN4 = 3, NN6+ = 4, others = 0
+_dom = document.all?(document.getElementById?2:1)
+		   :(document.getElementById?4
+		   :(document.layers?3:0));
+var _calendar3_popElement = null;
+var _calendar3_popCount = 0;
+
+function moveDivTo(div,left,top){
+  if(_dom==4){
+    div.style.left=left+'px';
+    div.style.top =top +'px';
+    return;
+  }
+  if(_dom==2 || _dom==1){
+    div.style.pixelLeft=left;
+    div.style.pixelTop =top;
+    return;
+  }
+  if(_dom==3){
+    div.moveTo(left,top);
+    return;
+  }
+}
+
+function moveDivBy(div,left,top){
+  if(_dom==4){
+    div.style.left=div.offsetLeft+left;
+    div.style.top =div.offsetTop +top;
+    return;
+  }
+  if(_dom==2){
+    div.style.pixelLeft=div.offsetLeft+left;
+    div.style.pixelTop =div.offsetTop +top;
+    return;
+  }
+  if(_dom==1){
+    div.style.pixelLeft+=left;
+    div.style.pixelTop +=top;
+    return;
+  }
+  if(_dom==3){
+    div.moveBy(left,top);
+    return;
+  }
+}
+
+function getDivLeft(div){
+  if(_dom==4 || _dom==2) return div.offsetLeft;
+  if(_dom==1)            return div.style.pixelLeft;
+  if(_dom==3)            return div.left;
+  return 0;
+}
+
+function getDivTop(div){
+  if(_dom==4 || _dom==2) return div.offsetTop;
+  if(_dom==1)            return div.style.pixelTop;
+  if(_dom==3)            return div.top;
+  return 0;
+}
+
+function getDivWidth (div){
+  if(_dom==4 || _dom==2) return div.offsetWidth;
+  if(_dom==1)            return div.style.pixelWidth;
+  if(_dom==3)            return div.clip.width;
+  return 0;
+}
+
+function getDivHeight(div){
+  if(_dom==4 || _dom==2) return div.offsetHeight;
+  if(_dom==1)            return div.style.pixelHeight;
+  if(_dom==3)            return div.clip.height;
+  return 0;
+}
+
+function popup(target,element,notitle) {
+  _calendar3_popCount++;
+  popdownNow();
+  if (navigator.appName=='Microsoft Internet Explorer') {
+    moveDivTo(element,getDivLeft(target)+getDivWidth(target),getDivTop(target)+getDivHeight(target)*13/8);
+  } else {
+    moveDivTo(element,getDivLeft(target)+getDivWidth(target)/2,getDivTop(target)+(getDivHeight(target)*2)/3);
+  }
+  element.style.display="block";
+  notitle.title="";
+}
+
+function popdown(element) {
+  _calendar3_popElement=element;
+  setTimeout('popdownDelay()', 2000);
+}
+
+function popdownDelay() {
+  _calendar3_popCount--;
+  if (_calendar3_popCount==0) {
+    popdownNow();
+  }
+}
+
+function popdownNow() {
+  if (_calendar3_popElement!=null) {
+    _calendar3_popElement.style.display="none";
+    _calendar3_popElement=null;
+  }
+}
+
Index: calendar3.rb
===================================================================
RCS file: /cvsroot/tdiary/plugin/calendar3.rb,v
retrieving revision 1.35
diff -u -2 -p -I^#! -r1.35 calendar3.rb
--- calendar3.rb	27 Oct 2003 15:49:03 -0000	1.35
+++ calendar3.rb	12 Dec 2003 16:56:44 -0000
@@ -127,13 +127,11 @@ end
 # 1.4 -> 1.5
 unless /1\.5\..*/ === TDIARY_VERSION
-eval(<<MODIFY_CLASS, TOPLEVEL_BINDING)
-class Diary
-	alias :each_section :each_paragraph
-end
+	::Diary.class_eval do
+		alias_method :each_section, :each_paragraph
+	end
 
-class Paragraph
-	alias :to_src :text
-end
-MODIFY_CLASS
+	::Paragraph.class_eval do
+		alias_method :to_src, :text
+	end
 end
 
@@ -242,114 +240,6 @@ if @calendar3_show_popup
 	add_header_proc do
     <<JAVASCRIPT
-  <script type="text/javascript">
-  <!--
-  // http://www.din.or.jp/~hagi3/JavaScript/JSTips/Mozilla/
-  // _dom : kind of DOM.
-  //        IE4 = 1, IE5+ = 2, NN4 = 3, NN6+ = 4, others = 0
-  _dom = document.all?(document.getElementById?2:1)
-                     :(document.getElementById?4
-                     :(document.layers?3:0));
-  var _calendar3_popElement = null;
-  var _calendar3_popCount = 0;
-
-  function moveDivTo(div,left,top){
-    if(_dom==4){
-      div.style.left=left+'px';
-      div.style.top =top +'px';
-      return;
-    }
-    if(_dom==2 || _dom==1){
-      div.style.pixelLeft=left;
-      div.style.pixelTop =top;
-      return;
-    }
-    if(_dom==3){
-      div.moveTo(left,top);
-      return;
-    }
-  }
-
-  function moveDivBy(div,left,top){
-    if(_dom==4){
-      div.style.left=div.offsetLeft+left;
-      div.style.top =div.offsetTop +top;
-      return;
-    }
-    if(_dom==2){
-      div.style.pixelLeft=div.offsetLeft+left;
-      div.style.pixelTop =div.offsetTop +top;
-      return;
-    }
-    if(_dom==1){
-      div.style.pixelLeft+=left;
-      div.style.pixelTop +=top;
-      return;
-    }
-    if(_dom==3){
-      div.moveBy(left,top);
-      return;
-    }
-  }
-
-  function getDivLeft(div){
-    if(_dom==4 || _dom==2) return div.offsetLeft;
-    if(_dom==1)            return div.style.pixelLeft;
-    if(_dom==3)            return div.left;
-    return 0;
-  }
-
-  function getDivTop(div){
-    if(_dom==4 || _dom==2) return div.offsetTop;
-    if(_dom==1)            return div.style.pixelTop;
-    if(_dom==3)            return div.top;
-    return 0;
-  }
-
-  function getDivWidth (div){
-    if(_dom==4 || _dom==2) return div.offsetWidth;
-    if(_dom==1)            return div.style.pixelWidth;
-    if(_dom==3)            return div.clip.width;
-    return 0;
-  }
-
-  function getDivHeight(div){
-    if(_dom==4 || _dom==2) return div.offsetHeight;
-    if(_dom==1)            return div.style.pixelHeight;
-    if(_dom==3)            return div.clip.height;
-    return 0;
-  }
-
-  function popup(target,element,notitle) {
-    _calendar3_popCount++;
-    popdownNow();
-    if (navigator.appName=='Microsoft Internet Explorer') {
-      moveDivTo(element,getDivLeft(target)+getDivWidth(target),getDivTop(target)+getDivHeight(target)*13/8);
-    } else {
-      moveDivTo(element,getDivLeft(target)+getDivWidth(target)/2,getDivTop(target)+(getDivHeight(target)*2)/3);
-    }
-    element.style.display="block";
-    notitle.title="";
-  }
-
-  function popdown(element) {
-    _calendar3_popElement=element;
-    setTimeout('popdownDelay()', 2000);
-  }
-
-  function popdownDelay() {
-    _calendar3_popCount--;
-    if (_calendar3_popCount==0) {
-      popdownNow();
-    }
-  }
-
-  function popdownNow() {
-    if (_calendar3_popElement!=null) {
-      _calendar3_popElement.style.display="none";
-      _calendar3_popElement=null;
-    }
-  }
-  // -->
-</script>
+  <script type="text/javascript" src="plugin/calendar3.js">
+  </script>
 JAVASCRIPT
 	end
Index: color_code.rb
===================================================================
RCS file: color_code.rb
diff -N color_code.rb
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ color_code.rb	12 Dec 2003 16:56:44 -0000
@@ -0,0 +1,127 @@
+=begin
+=color-code.rb Ver0.1
+
+スタイルシートでスクリプトを色分けするtDiaryプラグイン
+
+== 作成日
+2003/05/25 ver0.1
+
+== 制作者
+さこと　sakoto@lapis.plala.or.jp
+http://kurage.s12.xrea.com/x/diary/index.rb
+
+== ライセンス
+ライセンス、クレジットの改編も含めて自由に改造再配布可
+
+== 内容
+プログラムをtDiary内で記述する時に、見栄えを整える。
+
+スクリプトを「""、''、%Q{} 、%W{}で囲まれたもの」「コメント」「予約語」「強調語」の４つの段階でCSSを用いて色分けをする。
+Ver0.1では予約語にRubyの予約語が、強調語に作者の好みによる言葉が入っている。
+
+予約語を変えることにより他の言語にも対応できる。
+テーマに強調用スタイルシートを加えること。
+
+= 使用法
+== 基本的なつかいかた
+<%=color_code %q{お好きなコード}%>
+
+== 使用例
+=== 変換前
+<%=color_code %q{
+class hogehoge
+	def initialize(value)
+		@value = "値" #コメント
+	end
+end
+}%>
+=== 変換後
+ <pre class="color-code">
+ <em class="color-code-syntax">class </em>hogehoge
+     <em class="color-code-syntax">def</em> <em class="color-code-emphasis">initialize</em>(value)
+         @value = <em class="color-code-value">"値"</em>
+     <em class="color-code-syntax"><em class="color-code-syntax">end</em></em> 
+ <em class="color-code-syntax"><em class="color-code-syntax">end</em></em>
+ </pre>
+
+= スタイルシート記述例
+これを御利用のテーマにコピペしてみてください。
+
+	div.body pre.color-code{
+		color: #000000;
+		background-color: #f5f5f5;
+	}
+
+	pre.color-code em.color-code-value{
+		color: #FF33FF;
+		font-style: normal;
+	}
+
+	pre.color-code em.color-code-comment{
+		color: #339933;
+		font-style: normal;
+	}
+
+	pre.color-code em.color-code-syntax{
+		color: #0033FF;
+		font-style: normal;
+	
+	}
+
+	pre.color-code em.color-code-emphasis{
+		color: #FF3300;
+		font-style: normal;
+	}
+
+= 注意点
+= コード中に空行があるとエラーが起きます！！
+空行を造りたいときはタブか全角スペースをいっこいれといてください。
+
+=end
+
+
+def color_code(str)
+
+	#--------------------------------------------------------------------
+	#設定
+	#--------------------------------------------------------------------
+	#----　タブを変換するときのスペースの個数　0ならタブのまま(＝無変換)
+	space = @options ? @options['color_code.tab_width'].to_i : 8
+
+	#----　一般的な予約語　色分け時はcolor-code-syntaxクラスになる。
+	syntax = /\b(?:BEGIN|END|alias|and|begin|break|case|def|defined?|do|else|elsif|end|ensure|false|for|module|next|nil|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield|if|not|in|or)\b/
+
+	#----　強調語　色分け時はcolor-code-emphasisクラスになる
+	emphasis = /\b(?:require|private|public|include|attr_reader|attr_writer|attr_accessor|initialize|protected|each|times|__FILE__|__LINE__)\b/
+
+	#設定おわり
+	#--------------------------------------------------------------------
+
+	result = %Q{<pre class="color-code">}
+
+	#いろいろ置換 gsub!を使う関係上、置換の順番が大事
+	str.each do |code|
+		code.chomp!
+
+		code.gsub!(/&/,"&amp;lt;")
+		code.gsub!(/</,"&lt;")
+		code.gsub!(/>/,"&gt;")
+		code.gsub!(/\t/," "*space) unless space == 0
+		
+		code.gsub!(/".*?"/, %q{<em class="color-code-value">\&</em>})
+		code.gsub!(/'.*?'/, %q{<em class="color-code-value">\&</em>})
+		code.gsub!(/%q{.*?}/i, %q{<em class="color-code-value">\&</em>})
+		code.gsub!(/%w{.*?}/i, %q{<em class="color-code-value">\&</em>})
+
+		code.gsub!(syntax, %q{<em class="color-code-syntax">\&</em>})
+		code.gsub!(emphasis, %q{<em class="color-code-emphasis">\&</em>})
+
+		code.gsub!(/#.*/,%q{<em class="color-code-comment">\&</em>})
+
+		result << code << "\n"
+	end
+
+	result << "</pre>\n"
+end
+
+# vi: sw=2 ts=2
Index: favicon.rb
===================================================================
RCS file: favicon.rb
diff -N favicon.rb
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ favicon.rb	12 Dec 2003 16:56:44 -0000
@@ -0,0 +1,12 @@
+add_header_proc do
+    imgs = {"ico"=>"x-icon"}
+    s = []
+    %w[icon shortcut_icon].each do |i|
+	if f = @conf.options['favicon.'+i]
+	    t = f[/\w+$/]
+	    t = imgs.fetch(t, t)
+	    s << %{<link rel="#{i.tr('_', ' ')}" href="#{f}" type="image/#{t}">}
+	end
+    end
+    "\t"+s.join("\n\t")+"\n"
+end
Index: gradation.rb
===================================================================
RCS file: /cvsroot/tdiary/plugin/gradation.rb,v
retrieving revision 1.1
diff -u -2 -p -I^#! -r1.1 gradation.rb
--- gradation.rb	6 Mar 2002 02:24:21 -0000	1.1
+++ gradation.rb	12 Dec 2003 16:56:44 -0000
@@ -14,5 +14,6 @@
 def gradation( str, first_color, last_color )
 	ary = str.split( // )
-	len = ary.length - 1
+	last = ary.pop
+	len = ary.length
 	result = ""
 	r = first_color[0..1].hex.to_f
@@ -22,12 +23,15 @@ def gradation( str, first_color, last_co
 	gd = ((last_color[2..3].hex - g)/len)
 	bd = ((last_color[4..5].hex - b)/len)
-	ary.each do |x|
+	col = proc do |x|
 		c = sprintf( '%02x%02x%02x', r, g, b )
-		result << %Q[<span style="color: ##{c}">#{x}</span>]
+		%Q[<span style="color: ##{c}">#{x}</span>]
+	end
+	ary.each do |x|
+		result << col[x]
 		r += rd
 		g += gd
 		b += bd
 	end
-	result
+	result << col[last]
 end
 
Index: htmlruby.rb
===================================================================
RCS file: htmlruby.rb
diff -N htmlruby.rb
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ htmlruby.rb	12 Dec 2003 16:56:44 -0000
@@ -0,0 +1,52 @@
+# htmlruby.rb
+#
+# htmlruby: rubyタグ生成plugin
+#
+# usage:
+#   (1) <%= htmlruby '林檎', 'りんご' %>
+#   (2) <%= htmlruby '林檎|りんご' %>
+#
+#   注意: 文字中に「|」自身を含む場合は、(1)形式をお使いください。
+#
+# Copyright (c) 2003 Kazuhiko TAKEDA <kztakeda@t3.rim.or.jp>
+# Distributed under the GPL
+#
+# history
+#   2003.06.01:  まず(2)形式を作成
+#   2003.06.08:  林隆一郎さん(sodium@da2.so-net.ne.jp)提案のパッチにより(1)形式へ対応。
+#
+
+def htmlruby(body, *args)
+  if paren = @options['htmlruby.paren']
+    paren = paren.split if String === paren
+  else
+    paren = %w[( ; )]
+  end
+  if paren.size == 2
+    paren[1, 0] = ';'
+  end
+  lparen, mparen, rparen = paren.collect {|paren| "<rp>#{paren}</rp>"}
+  if args.size == 1 and /\|/ !~ body
+    ruby = *args
+  elsif args.size == 0
+    body, ruby = body.split(/\|/)
+  else
+    bodies = []
+    rubies = []
+    under = ""
+    args.unshift(body)
+    args.collect do |str|
+      body, ruby, str = str.split(/\|/, 3)
+      bodies << body
+      rubies << ruby
+      under << str if str
+    end
+    r = "<ruby>"
+    r << "<rbc>" << bodies.collect {|body| "<rb>#{body}</rb>"}.join << "</rbc>"
+    r << "<rtc>#{lparen}" << rubies.collect {|ruby| "<rt>#{ruby}</rt>"}.join
+    r << %[#{mparen}</rtc><rtc><rt rbspan="#{bodies.size}">#{under}</rt>] unless under.empty?
+    return r << "#{rparen}</rtc></ruby>"
+  end
+  "<ruby><rb>#{body}</rb>#{lparen}<rt>#{ruby}</rt>#{rparen}</ruby>"
+end
+alias rb htmlruby
Index: last_modified.rb
===================================================================
RCS file: last_modified.rb
diff -N last_modified.rb
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ last_modified.rb	12 Dec 2003 16:56:44 -0000
@@ -0,0 +1,3 @@
+add_body_enter_proc do |date|
+#  "<span@diary.last_modified.strftime("%c")
+end
Index: makelirs.rb
===================================================================
RCS file: /cvsroot/tdiary/plugin/makelirs.rb,v
retrieving revision 1.7
diff -u -2 -p -I^#! -r1.7 makelirs.rb
--- makelirs.rb	19 Nov 2003 14:55:58 -0000	1.7
+++ makelirs.rb	12 Dec 2003 16:56:44 -0000
@@ -42,5 +42,5 @@
 
 if /^(append|replace|comment|trackbackreceive)$/ =~ @mode then
-	file = @options['makelirs.file'] || 'antenna.lirs'
+	file = @options['makelirs.file'] || File.join(@conf.data_path, 'antenna.lirs')
 
 	# create_lirs
Index: output_rdf.rb
===================================================================
RCS file: /cvsroot/tdiary/plugin/output_rdf.rb,v
retrieving revision 1.17
diff -u -2 -p -I^#! -r1.17 output_rdf.rb
--- output_rdf.rb	19 Nov 2003 14:55:58 -0000	1.17
+++ output_rdf.rb	12 Dec 2003 16:56:44 -0000
@@ -17,5 +17,5 @@ if ( /^(append|replace|trackbackreceive)
 	diary = @diaries[date]
 	uri = "#{@conf.base_url}#{@conf.index}".gsub(%r|/\./|, '/')
-	rdf_file = @options['output_rdf.file'] || 'index.rdf'
+	rdf_file = @options['output_rdf.file'] || File.join(@conf.data_path, 'index.rdf')
 	rdf_channel_about = "#{@conf.base_url}#{rdf_file}"
 	r = ""
Index: q.rb
===================================================================
RCS file: q.rb
diff -N q.rb
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ q.rb	12 Dec 2003 16:56:44 -0000
@@ -0,0 +1,17 @@
+# q.rb $Revision$
+
+def q( src, title = nil, url = nil )
+  result = "<q"
+  result << %Q[ cite="#{url}"] if url
+  result << %Q[ title="#{title}"] if title
+  result << ">"
+  result << src
+  result << "</q>"
+  if url
+    result << %Q[<p class="source">[<cite><a href="#{url}" title="#{title}より引用">#{title}</a></cite>より引用]</p>\n]
+  elsif title
+    result << %Q[<p class="source">[<cite>#{title}</cite>より引用]</p>\n]
+  end
+  result
+end
+
Index: recent_comment.rb
===================================================================
RCS file: /cvsroot/tdiary/plugin/recent_comment.rb,v
retrieving revision 1.4
diff -u -2 -p -I^#! -r1.4 recent_comment.rb
--- recent_comment.rb	25 Sep 2003 02:17:29 -0000	1.4
+++ recent_comment.rb	12 Dec 2003 16:56:44 -0000
@@ -16,5 +16,6 @@
 def recent_comment( max = 3, sep = '&nbsp;', form = nil, except = nil )
 	form = "(#{@date_format + ' %H:%M'})" unless form
-	comments = []
+   except &&= /#{except}/
+   comments = []
 	date = {}
 	index = {}
@@ -22,5 +23,5 @@ def recent_comment( max = 3, sep = '&nbs
 		next unless diary.visible?
 		diary.each_comment_tail( max ) do |comment, idx|
-			if except && (/#{except}/ =~ comment.name)
+			if except && (except =~ comment.name)
 				next
 			end
@@ -31,5 +32,5 @@ def recent_comment( max = 3, sep = '&nbs
 	end
 	result = []
-	comments.sort{|a,b| (a.date)<=>(b.date)}.reverse.each_with_index do |com,idx|
+	comments.sort_by{|x| x.date}.reverse.each_with_index do |com,idx|
 		break if idx >= max
 		str = ''
Index: ry.rb
===================================================================
RCS file: ry.rb
diff -N ry.rb
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ry.rb	12 Dec 2003 16:56:44 -0000
@@ -0,0 +1,13 @@
+class << @conf
+  alias :_shorten :shorten
+  def shorten(*args)
+    _shorten(*args).sub(/\.\.$/, '(ry')
+  end
+end
+ 
+::TDiary::Comment.class_eval do
+  alias :_shorten :shorten
+  def shorten(*args)
+    _shorten(*args).sub(/\.\.$/, '(ry')
+  end
+end
Index: squeeze.rb
===================================================================
RCS file: /cvsroot/tdiary/plugin/squeeze.rb,v
retrieving revision 1.14
diff -u -2 -p -I^#! -r1.14 squeeze.rb
Index: tdiarytimes.rb
===================================================================
RCS file: tdiarytimes.rb
diff -N tdiarytimes.rb
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tdiarytimes.rb	12 Dec 2003 16:56:44 -0000
@@ -0,0 +1,157 @@
+# tdiarytimes.rb $Revision: 1.0 $
+#
+# Copyright (c) 2003 neuichi <neuichi@nmnl.jp>
+# Distributed under the GPL
+#
+# プラグイン配布ページ
+# http://nmnl.jp/hiki/software/?tDiary+%3A%3A+Plugin
+#
+# 動作条件:
+# ruby-gdが使える環境が必要です。
+#
+# 使い方:
+# このプラグインをプラグインディレクトリに入れ、
+# index.rbと同じディレクトリに、tdiarytimes.pngという名前の
+# サーバが書き込み権限を持っているファイルを作ります。
+#	これで日記に書き込みするごとに、tdiarytimes.pngに
+#	画像を書き込みます。
+# 
+# 日記上からこのpngファイルを呼び出すには、
+# tDiray上からプラグインとして
+# <%=tdiarytimes%>
+# として呼び出します。
+# 引数としてimgタグのaltの文字列を指定することも出来ます。
+# <%=tdiarytimes '文字列'%>
+#
+# また、tdiary.confに以下のオプションを書き込むことにより、
+# カスタマイズをすることが出来ます。
+# 
+# @options['tdiarytimes.width'] = 400
+# 四角の横幅。デフォルト値400。
+# 実際に出力される画像サイズは、これに+10したサイズ。
+# 
+# @options['tdiarytimes.height'] = 20
+# 四角の縦幅。デフォルト値20。
+# 実際に出力される画像サイズは、これに+16したサイズ。
+# 
+# @options['tdiarytimes.file'] = 'tdiarytimes.png'
+# 出力する画像ファイル名。デフォルトは'tdiarytimes.png'
+# 
+# @options['tdiarytimes.fillcolor'] = '#444444'
+# 四角の色。デフォルトは'#444444'
+# 
+# @options['tdiarytimes.linecolor'] = '#ffffff'
+# 縦棒の色。デフォルトは'#ffffff'
+# 
+# @options['tdiarytimes.textcolor'] = '#444444'
+# 文字色。デフォルトは'#444444'
+# 
+# @options['tdiarytimes.text'] = 'T D I A R Y T I M E S'
+# 出力する文字。デフォルトは'T D I A R Y T I M E S'。なお半角英数字のみ対応。
+# 
+# @options['tdiarytimes.day'] = 30
+# ログを保存する最大日数。デフォルトは30。
+# この場合、30日以上経ったデータは消去され、縦棒として描画されなくなる。
+#
+
+if /^(append|replace)$/ =~ @mode then
+
+	require 'GD'
+
+	#初期設定
+	width = @options['tdiarytimes.width'] || 400
+	height = @options['tdiarytimes.height'] || 20
+	file = @options['tdiarytimes.file'] || 'tdiarytimes.png'
+	fillcolor = @options['tdiarytimes.fillcolor'] || '#444444'
+	linecolor = @options['tdiarytimes.linecolor'] || '#ffffff'
+	textcolor = @options['tdiarytimes.textcolor'] || '#444444'
+	text = @options['tdiarytimes.text'] || 'T D I A R Y T I M E S'
+	day = @options['tdiarytimes.day'] || 30 
+	
+	cache = "#{@cache_path}/tdiarytimes"
+	Dir::mkdir( cache ) unless File::directory?( cache )
+
+	image = GD::Image.new(width + 10,height + 16)
+	transcolor = image.colorAllocate("#fffffe")
+	image.transparent(transcolor)
+	image.interlace = TRUE
+	fillcolor = image.colorAllocate(fillcolor)
+	linecolor = image.colorAllocate(linecolor)
+	textcolor = image.colorAllocate(textcolor)
+	
+	#帯の描画
+	image.filledRectangle(5,8,width + 4,height + 7,fillcolor)
+
+	#時間挿入
+	if width >= 160
+		hour = 2
+		hour_w = width / 12.0
+		image.string(GD::Font::TinyFont, 2, height + 8, "0", textcolor)
+		11.times {
+			image.string(GD::Font::TinyFont, (hour_w * hour/2).to_i , height + 8, hour.to_s, textcolor)
+			hour += 2
+		}
+		image.string(GD::Font::TinyFont, width + 2, height + 8, "0", textcolor)
+	else
+		hour = 0
+		hour_w = width / 6.0
+		6.times {
+			image.string(GD::Font::TinyFont, (hour_w * hour/4).to_i + 4, height + 8, hour.to_s, textcolor)
+			hour += 4
+		}
+		image.string(GD::Font::TinyFont, width + 2, height + 8, "0", textcolor)
+	end
+
+	#現在時刻の保存,読み込み
+	begin
+		ary_times = open("#{cache}/tdiarytimes.dat","r", &Marshal.method(:load))
+	rescue
+		ary_times = []
+	end
+
+	ary_times << Time.now.to_f
+	ary_times_new = []
+
+	while ary_times.size != 0
+		time = ary_times.shift
+		time_now = Time.now.to_f.to_i
+		ary_times_new << time.to_i if (86400 * day) > (time_now - time).to_i
+	end
+
+	ary_times = ary_times_new
+
+	open("#{cache}/tdiarytimes.dat","w") do |io|
+	  Marshal.dump(ary_times,io)
+	end
+
+
+	#時間軸の挿入
+	while ary_times.size != 0
+		time = Time.at(ary_times.shift)
+		time_w = ((time.hour * 60 + time.min) / 1440.0 * width).to_i
+		image.line(time_w + 5, 8 ,time_w + 5,height + 7, linecolor)
+	end
+
+	#文字の挿入
+	image.string(GD::Font::TinyFont, 5, 0, text, textcolor)
+
+	open(file, 'w', &image.method(:png))
+end
+
+def tdiarytimes(alt = nil)
+	width = @options['tdiarytimes.width'] || 400
+	width += 10
+	
+	height = @options['tdiarytimes.height'] || 20
+	height += 16
+	
+	file = @options['tdiarytimes.file'] || 'tdiarytimes.png'
+	text = @options['tdiarytimes.text'] || 'T D I A R Y T I M E S'
+
+	result = ""
+
+	result << "<img src=\"#{file}\" alt=\"#{alt||text}\" width=\"#{width}\" height=\"#{height}\" class=\"tdiarytimes\">"
+
+	result
+
+end
Index: windex.rb
===================================================================
RCS file: /cvsroot/tdiary/plugin/windex.rb,v
retrieving revision 1.2
diff -u -2 -p -I^#! -r1.2 windex.rb
Index: a/a_conf.rb
===================================================================
RCS file: /cvsroot/tdiary/plugin/a/a_conf.rb,v
retrieving revision 1.2
diff -u -2 -p -I^#! -r1.2 a_conf.rb
Index: ja/disp_referrer.rb
===================================================================
RCS file: /cvsroot/tdiary/plugin/ja/disp_referrer.rb,v
retrieving revision 1.6
diff -u -2 -p -I^#! -r1.6 disp_referrer.rb
--- ja/disp_referrer.rb	18 Nov 2003 16:36:03 -0000	1.6
+++ ja/disp_referrer.rb	12 Dec 2003 16:56:44 -0000
@@ -527,3 +527,4 @@ DispReferrer2_Engines = {
 	'planet' => [[%r{^http://www\.planet\.nl/planet/}i, '"Planet-Zoekpagina"', ['googleq', 'keyword'], DispReferrer2_Google_cache]], # googleq parameter has a strange prefix
 	'216' => [[%r{^http://(\d+\.){3}\d+/search}i, '"Google検索?"', ['as_q', 'q'], DispReferrer2_Google_cache]],	# cache servers of google?
+	'overture' => [[%r{^http://www\.overture\.com/d/search/}i, '"overture検索"', ['Keywords'], nil]],
 }
Index: trackback/tb.rb
===================================================================
RCS file: /cvsroot/tdiary/plugin/trackback/tb.rb,v
retrieving revision 1.7
diff -u -2 -p -I^#! -r1.7 tb.rb

