«前の日記(2008-03-04(火)) 最新 次の日記(2008-03-10(月))» 編集
RSS feed

からっぽの日記


2008-03-07(金) [長年日記]

tDiary 2.2.1 の導入の巻

さくらインターネットの tDiary を 2.2.1 へバージョンアップした時の作業メモ。内容はほぼ2.2.0の時と変わってないけど、一応。

ダウンロード

% wget http://www.tdiary.org/download/tdiary-full-2.2.1.tar.gz
% wget http://www.tdiary.org/download/tdiary-contrib.tar.gz
% tar zxf tdiary-full-2.2.1.tar.gz
% tar zxf tdiary-contrib.tar.gz

プラグイン

TrackBack

% cp -p tdiary-2.2.1/misc/plugin/trackback/tb.rb tdiary-2.2.1/
% chmod 755 tdiary-2.2.1/tb.rb

category_to_tag.rb

% cp -p tdiary-contrib/plugin/category_to_tag/category_to_tag.rb tdiary-2.2.1/misc/plugin/

iddy.rb

% cp -p tdiary-contrib/plugin/iddy/iddy.rb tdiary-2.2.1/misc/plugin/

jdate.rb

% cp -p tdiary-contrib/plugin/japanese/jdate.rb tdiary-2.2.1/misc/plugin/

google_sitemaps.rb

% wget http://d.bulkitem.com/archives/google_sitemaps.tar.gz
% md5 google_sitemaps.tar.gz
% cp -p google_sitemaps/google_sitemaps.rb tdiary-2.2.1/misc/plugin/
% cp -p google_sitemaps/ja/google_sitemaps.rb tdiary-2.2.1/misc/plugin/ja/

category_to_tagcloud.rb

% wget http://www.smallstyle.com/lab/category_to_tagcloud.txt
% cp -p category_to_tagcloud.txt tdiary-2.2.1/misc/plugin/category_to_tagcloud.rb

search_control.rb の改造

% vi search_control.rb.patch

search_control.rb.patch

--- tdiary-2.2.1/misc/plugin/search_control.rb.orig	Thu May  3 11:36:03 2007
+++ tdiary-2.2.1/misc/plugin/search_control.rb	Mon Mar  3 00:14:12 2008
@@ -212,7 +212,7 @@
 	# output
 	sw = @conf[_sc_vkey( view, number )]
 	if sw then
-		%Q|\t<meta name="robots" content="#{'f' == sw ? 'noindex' : 'index' },#{follow}">\n|
+		%Q|\t<meta name="robots" content="noarchive,#{'f' == sw ? 'noindex' : 'index' },#{follow}">\n|
 	else
 		''
 	end
% patch < search_control.rb.patch

recent_list.rb の改造

% vi recent_list.rb.patch

recent_list.rb.patch

--- tdiary-2.2.1/misc/plugin/recent_list.rb.orig	Sun Jan 14 13:02:17 2007
+++ tdiary-2.2.1/misc/plugin/recent_list.rb	Mon Mar  3 00:47:41 2008
@@ -58,7 +58,7 @@
 								result << %Q|\t<li><a href="#{h( @index )}#{anchor( "%s#p%02d" % [date, i] )}"|
 								result << %Q| title="#{h( @conf.shorten( apply_plugin( section.body_to_html, true) ) )}"| if title_with_body == true
 								result << %Q|>#{i}</a>. | \
-										<< %Q|#{section.stripped_subtitle_to_html}</li>\n|
+										<< %Q|#{apply_plugin(section.stripped_subtitle_to_html).gsub(/<[^>]*>/, '')}</li>\n|
 							end
 							i += 1
 						end
@@ -68,7 +68,7 @@
 								result << %Q|\t<li><a href="#{h( @index )}#{anchor( "%s#p%02d" % [date, i] )}"|
 								result << %Q| title="#{h( @conf.shorten( apply_plugin(section.body_to_html, true) ) )}"| if title_with_body == true
 								result << %Q|>#{i}</a>. | \
-										<< %Q|#{section.subtitle_to_html}</li>\n|
+										<< %Q|#{apply_plugin(section.subtitle_to_html).gsub(/<[^>]*>/, '')}</li>\n|
 							end
 							i += 1
 						end
% patch < recent_list.rb.patch

photozou.rb(自作)

% cp -p ~/www/diary/misc/plugin/photozou.rb tdiary-2.2.1/misc/plugin/

meta.rb(自作 - metaタグの設定))

% cp -p ~/www/diary/misc/plugin/meta.rb tdiary-2.2.1/misc/plugin/

SHJS

% wget http://nchc.dl.sourceforge.net/sourceforge/shjs/shjs-0.4.2.zip
% unzip shjs-0.4.2.zip
% rm shjs-0.4.2/*.txt
% rm -r shjs-0.4.2/doc/
% rm shjs-0.4.2/index.html
% cp -pr shjs-0.4.2 tdiary-2.2.1/shjs
% vi hikidoc.rb.patch

hikidoc.rb.patch

--- tdiary-2.2.1/misc/lib/hikidoc.rb.orig	Wed Feb 13 18:09:16 2008
+++ tdiary-2.2.1/misc/lib/hikidoc.rb	Mon Mar  3 22:08:26 2008
@@ -670,8 +670,10 @@
       syntax = info ? info.downcase : nil
       if syntax
         begin
-          convertor = Syntax::Convertors::HTML.for_syntax(syntax)
-          @f.puts convertor.convert(str)
+          @f.puts "<pre class=\"sh_#{syntax}\">"
+          @f.puts str
+          @f.puts "</pre>"
+          @f.puts "<script type=\"text/javascript\" src=\"shjs/lang/sh_#{syntax}.min.js\"></script>"
           return
         rescue NameError, RuntimeError
         end
% patch < hikidoc.rb.patch
% vi tdiary-2.2.1/misc/plugin/shjs.rb

shjs.rb

add_header_proc do
  <<-HTML
  <link rel="stylesheet" type="text/css" href="shjs/sh_style.css" />
  <script type="text/javascript" src="shjs/sh_main.min.js"></script>
  <script type="text/javascript"><!--
  if (window.addEventListener) {
    window.addEventListener('load', sh_highlightDocument, false);
  } else if (window.attachEvent) {
    window.attachEvent('onload', sh_highlightDocument);
  } else {
    window.onload = sh_highlightDocument;
  }
  //--></script>
  HTML
end

使用中のプラグイン

  • amazon.rb
  • bq.rb
  • calendar2.rb
  • category.rb
  • category_to_tag.rb
  • category_to_tagcloud.rb
  • disp_referrer.rb
  • footnote.rb
  • google_sitemaps.rb
  • highlight.rb
  • html_anchor.rb
  • iddy.rb
  • image.rb
  • jdate.rb
  • makerss.rb
  • meta.rb
  • my-ex.rb
  • my-sequel.rb
  • photozou.rb
  • ping.rb
  • recent_comment.rb
  • recent_list.rb
  • recent_trackback3.rb
  • search_control.rb
  • shjs.rb
  • tb-send.rb
  • tb-show.rb

入れ換え

% cp -p ~/www/diary/robots.txt tdiary-2.2.1/
% cp -p ~/www/diary/.htaccess tdiary-2.2.1/
% cp -p ~/www/diary/tdiary.conf tdiary-2.2.1/
% cp -p ~/www/diary/index.rdf tdiary-2.2.1/
% cp -p ~/www/diary/sitemap.xml tdiary-2.2.1/
% cp -rp ~/www/diary/images tdiary-2.2.1/
% rm ~/www/diary
% mv tdiary-2.2.1 ~/www/diary

«前の日記(2008-03-04(火)) 最新 次の日記(2008-03-10(月))» 編集
RSS feed