tdiary-blogkit 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.en.md ADDED
@@ -0,0 +1,107 @@
1
+ # tDiary BlogKit: How to run tDiary like blog. --
2
+
3
+ ## What's BlogKit?
4
+
5
+ tDiary BlogKit modifies tDiary. This modification enables tDiary to manage articles by topics, not daily. tDiary with BlogKit is different from original one:
6
+
7
+ * Date has no meaning. It looks like 'serial number'.
8
+ * Each topic have last-modified.
9
+ * Top page has the 1st section of each topic(like summary).
10
+ * tDiary with BlogKit makes new topic number automatically when update.
11
+ * BlogKit adds new features: 'Recent Entries' and 'What's New'.
12
+
13
+ You can setup BlogKit without changing tDiary. It is only plugged-in.
14
+
15
+ ## how to install
16
+
17
+ First, you need tDiary that is installed. You must use tDiary version 2.1.3 or later. Here, it is assumed that you install tDiary under $INSTALL anew.
18
+
19
+ ### Creating tdiary.conf
20
+
21
+ Copy tdiary.conf.sample in BlogKit to $INSTALL/tdiary.conf. And, rewrite @data\_path in the tdiary.conf to your data saving directory. Read README of tDiary about @data_path.
22
+
23
+ ### Copy blog_style.rb
24
+
25
+ #### To use tDiary style
26
+
27
+ Copy tdiary/blog_style.rb of BlogKit under $INSTALL/tdiary. You have to confirm there is "@style= 'Blog'" in your tdiary.conf.
28
+
29
+ #### To use Wiki style
30
+
31
+ If you want to write by Wiki style, install Wiki style of tDiary original and copy tdiary/blogwiki_style.rb into $INSTALL/tdiary. And specify "@style = 'BlogWiki'" in your tdiary.conf.
32
+
33
+ #### To use RD style
34
+
35
+ Also if you want to write by RD style, install RD style of tDiary original and copy tdiary/blogrd_style.rb into $INSTALL/tdiary. And specify "@style = 'BlogRD'" in your tdiary.conf.
36
+
37
+ ### Copy theme
38
+
39
+ A sample theme for BlogKit available in tdiary-theme package named by "blog'. This is one kind of tDiary themes, but it has some settings to enable sidebar etc.
40
+
41
+ ### Copy Plugins
42
+
43
+ After tDiary 2.0.1, you can select plugin in preference page. Add the path of BlogKit plugins into tdiary.conf:
44
+
45
+ @options['sp.path'] = ['misc/plugin', 'blogkit/plugin']
46
+
47
+ This option can have some pathes of plugins, 1st path is tDiary plugin collection. 2nd path is BlogKit's. Modify path name with your environment.
48
+
49
+ ### and run tDiary as CGI
50
+
51
+ When you want to add a new topic, click 'Update' link at the bottom of the page. If you want to edit existing page, open the topic and click 'Edit' link at the bottom of the page.
52
+
53
+ ## About Plugins
54
+
55
+ See each plugin file if you want more information.
56
+
57
+ ### archive.rb
58
+
59
+ #### archive plugin
60
+
61
+ Shows all the topics in group sorted by topic number. By default, this plugin shows the topics in the sidebar.
62
+
63
+ #### archive\_dropdown plugin
64
+
65
+ Like archive plugin, this plugin shows all the topics in group. The topics are shown in dropdown list.
66
+
67
+ ### blog-style.rb
68
+
69
+ Changes 'Diary like' labels to 'Blog like' and adjust title style. You should enable this plugin for using BlogKit.
70
+
71
+ ### lm.rb
72
+
73
+ Shows last-modified in each topic. You can choose position of the last-modified, under topic title or bottom of article. You can use this plugin only by copying this plugin to plugin directory.
74
+
75
+ ### recent-entry.rb
76
+
77
+ Shows the list of the recent topics. You have to choose this plugin or recent-entry2.
78
+
79
+ ### title-navi.rb
80
+
81
+ Shows a topic title as navigation label. You can use this plugin only by copying this plugin to plugin directory.
82
+
83
+ ### whatsnew-list.rb
84
+
85
+ Shows a list of updated topics like "What's new". This plugin cannot be used on secure mode. And it can generate RDF file when option setting in tdiary.conf.
86
+
87
+ ### blog-category.rb
88
+
89
+ Add category feature. A word surrounded by '[' and ']' is treated as a name of category. By clicking this category name, you can move to the page which displays articles of the category. You should initialize the index of category in the config page of tDiary.
90
+
91
+ #### blog\_category\_entry plugin
92
+
93
+ Show the list of titles which can't be shown in the category specific page.
94
+
95
+ #### blog\_category\_form plugin
96
+
97
+ Shows all categories in dropdown list. You can select a category to be shown.
98
+
99
+ ### title-link.rb
100
+
101
+ Make whole title to link to Permalink.
102
+
103
+ ## License
104
+
105
+ Copyright (C) by TADA Tadashi <sho@spc.gr.jp>.
106
+
107
+ You can distribute or modify this under GPL.
data/README.md ADDED
@@ -0,0 +1,120 @@
1
+ # tDiary BlogKit: tDiaryをblog風に運用する
2
+
3
+ ## はじめに
4
+
5
+ tDiary BlogKitは、tDiaryをblogのように日単位でなく記事単位で管理するシステムに改造するキットです。BlogKitを全面的に適用したtDiaryは、日記システムとしてのtDiaryに対して、以下のような違いを持ちます。
6
+
7
+ * 日付が意味を持たなくなる(記事番号扱いになる)
8
+ * 記事に「最終更新時刻(Last-Modified)」が付くようになる
9
+ * 最新表示時には、記事の最初のセクションだけが表示される(似非サマリ)
10
+ * 「更新」を選ぶと、自動的に空いている記事番号を割り当ててくれる
11
+ * Recent EntoriesやWhat's Newで更新情報が公開される
12
+
13
+ tDiary BlogKitは、tDiaryには影響を与えずに、すべてファイル追加のみで導入できます。
14
+
15
+ ## インストール
16
+
17
+ すでにtDiaryはインストール済みだとします。tDiaryは2.1.3もしくはそれ以降のできるだけ新しいものを推奨します。すでに運用中の日記ではなく、新たにblog系サイトを作るという前提で説明します。すでに運用中の日記に適用する場合には、tdiary.confのマージ作業などが必要になります(ただし日記とは管理単位が異なるので、すでにある日記にBlogKitを適用するのはオススメできません)。
18
+ ### tdiary.confを作成
19
+
20
+ 付属のtdiary.conf.sample\_jaを、tDiaryのインストールディレクトリにtdiary.confとしてコピーします。そして、@data\_pathをデータの保存場所に書き換えます。詳しくはtDiaryのドキュメントを参照してください。付属のサンプルには、ヘッダやフッタなどにblog風のレイアウト指定が施されています。これらのカスタマイズは、運用開始後に設定画面から行ってください。
21
+
22
+ tdiary.conf.sample_jaは日本語向けのサンプルです。英語向けにはtdiary.conf.sampleを使ってください。
23
+
24
+ ### スタイルをコピー
25
+
26
+ tdiary/style/blog.rbを、tDiaryインストールディレクトリのtdiary/styleの下にコピーします。このファイルは、BlogKit向けのさまざまな機能拡張を含んでいるので、他のスタイルを使う場合にもかならずコピーする必要があります。
27
+
28
+ tDiaryではさまざまな記法を使えます(スタイル機能)。BlogKitでは、すでに提供されているスタイルをベースに、blog向けにカスタマイズした専用のスタイルをいくつか提供しています。以下の3種類が提供されているので、好みの応じて使うようにして下さい。
29
+
30
+ なお、必要のないスタイルファイル(style/*.rb)をインストールすると、エラーの原因になりますので、以下の説明をよく読んで、不要なファイルを入れないように注意してください。ただし、先に書いたように、style/blog.rbはかならずコピーしてください。これを忘れると、記事の自動採番機能が効かなくなります。
31
+
32
+ #### tDiaryスタイルを使う場合
33
+
34
+ 必要なファイル(tdiary/style/blog.rb)のコピーは済んでいると思います。スタイルの指定も、先に作成したのtdiary.confに「@style = 'Blog'」の指定がすでにあるはずなので、確認してください。
35
+
36
+ #### Wikiスタイルを使う場合
37
+
38
+ style/blogwiki.rbをtdiary/style下にコピーし、@styleには'BlogWiki'を指定します。Wikiスタイルを使用しない場合には、この作業は行わないで下さい。
39
+
40
+ #### RDスタイルを使う場合
41
+
42
+ まずRDスタイルを導入して下さい(tdiary-style-rd gemをインストールします)。その上で、style/blogrd.rbをtdiary下にコピーし、@styleには'BlogRD'を指定します。RDスタイルを使用しない場合には、この作業は行わないで下さい。
43
+
44
+ ### テーマをコピー
45
+
46
+ サンプルとしてBlogKit向けのテーマがあります。この「blog」テーマはtdiary-themeパッケージに含まれているので、そちらを利用してください。このテーマはtDiaryの標準的テーマですが、サイドバーを使ったレイアウトのための設定や、blog用プラグインのための設定が追加されています。もちろん、通常のtDiary向けテーマも使えますが、微調整が必要かもしれません。
47
+
48
+ ### プラグインの設定
49
+
50
+ tDiary 2.0.1からは、プラグイン選択が設定画面からできるようになっています。BlogKit専用のプラグインも、ここから選択できるようにします。プラグイン選択がBlogKitを展開したディレクトリを参照できるように、tdiary.confにある以下の設定を修正してください。
51
+
52
+ @options['sp.path'] = ['misc/plugin', 'blogkit/plugin']
53
+
54
+ このオプションは複数のパスを指定できます。ひとつ目はtDiaryのプラグイン集のパスを指定してあるので、ふたつ目をBlogKitで配布されているプラグインのパスにしてあります。
55
+
56
+ もちろん、tDiaryのpluginディレクトリに、必要なプラグインをコピーする従来のインストール方法でもかまいません。
57
+
58
+ ### あとはtDiary同様に動かすだけ
59
+
60
+ 記事を追加するときには、画面下の「更新」をクリックします。日付は最新のものが自動的に入るので、「更新」時には常に新しい記事の追加になります。また、既存の記事の編集は、その記事を開いてから画面下の「編集」をクリックすることで行えます。
61
+
62
+ まず最初に、設定画面に入って、必要なプラグインを選択しましょう。
63
+
64
+ ## プラグイン解説
65
+
66
+ ここでは各プラグインの概要のみ解説します。指定方法などは個々のプラグインファイルを見てください。
67
+
68
+ ### archive.rb
69
+
70
+ #### archiveプラグイン
71
+
72
+ 過去記事一覧を表示します。サイドバーにデフォルトで配置されています。記事はグループ化されており(ようするに月単位ですが、BlogKitでは日付に意味がないので00001からの連番です)、新しい順に表示します。
73
+
74
+ #### archive\_dropdownプラグイン
75
+
76
+ archiveと同様の一覧を、ドロップダウンリストで表示します。
77
+
78
+ ### blog-style.rb
79
+
80
+ tDiaryとはやや異なった用語を使うblogツールに合わせて、各所の文字列を置き換えるプラグインです。また、タイトルの表現を変えるなど、1ページに1トピックというblog風体裁を整えるためには導入必須のプラグインだと考えてください。
81
+
82
+ ### lm.rb
83
+
84
+ Last-Modifiedを表示するプラグインです。タイトル下か、記事最下部のどちらに表示するか、tdiary.confで選択可能です。
85
+
86
+ ### recent-entry.rb
87
+
88
+ 最新の記事一覧を、新しい順に表示します。
89
+
90
+ ### title-navi.rb
91
+
92
+ tDiaryでは「前日」「翌日」になっていたナビゲーションボタンを、記事のタイトルで置き換えます。ただし、月をまたぐ場合には、「Prev」「Next」という表記になります。
93
+
94
+ ### whatsnew-list.rb
95
+
96
+ 記事が更新された順に一覧表示を行います。recent-entryと違い、過去の記事を更新しても上位に入れ替わります。secureモードでは動きません。また、設定画面からの指定によって、RDFファイルを生成することが可能です。
97
+
98
+ ### blog-category.rb
99
+
100
+ カテゴリ機能を追加します。タイトル中の [ ] で囲んだ文字列がカテゴリ名として認識されます。カテゴリ名をクリックするとそのカテゴリの記事のみを表示する画面に移ります。設定画面からカテゴリインデックスの初期化を行う必要があります。
101
+
102
+ #### blog\_category\_entryプラグイン
103
+
104
+ カテゴリ別画面に表示しきれなかった記事のタイトルを新しい順に表示します。
105
+
106
+ #### blog\_category\_formプラグイン
107
+
108
+ 表示するカテゴリを選択できるドロップダウンリストを表示します。
109
+
110
+ ### title-link.rb
111
+
112
+ 記事のタイトル全体をPermalinkへのリンクにします。従来のアンカー文字よりもPermalinkであることがよりわかりやすくなります。ただし、タイトル中にリンクを含めることができなくなりますので、運用に照らし合わせて使ってください。
113
+
114
+ ## ライセンス
115
+
116
+ GPLの元で改造、配布が可能です。
117
+
118
+ 作者はただただし<sho@spc.gr.jp>です。
119
+
120
+ BlogKitに関する最新情報は、http://www.tdiary.org/ で得られます。
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/UPDATE.en.md ADDED
@@ -0,0 +1,24 @@
1
+ # How to update from Blogkit 1.5.2 or before.
2
+
3
+ New blogkit support 'style'. If you have sites using old Blogkit, you have to change below:
4
+
5
+ 1. Remove blogio.rb in $INSTALL/tdiary. And copy new file blog_style.rb to same directory.
6
+ 2. Open tdiary.conf by textaeditor, and remove "require 'tdiary/blogio'" and add "@style = 'Blog'".
7
+
8
+ And convert data files:
9
+
10
+ 3. Find *.td2 files in your @data_path.
11
+ 4. Open these files by text editor, and replace all of "Format: tDiary" to "Format: Blog".
12
+ 5. Save all changes, and remove @data_path/cache/*.parser and @data_path/cache/*.rb.
13
+
14
+ If you cannot do above, one more method in compatible.
15
+
16
+ 3. Open blog_style.rb in text file, and find a line below.
17
+
18
+ # TDiary::DefaultIO::add_style( 'tDiary', self )
19
+
20
+ 4. Change this line to below (remove '#').
21
+
22
+ TDiary::DefaultIO::add_style( 'tDiary', self )
23
+
24
+ 5. Save the file, and remove *.parser and *.rb in @data_path/cache.
data/UPDATE.md ADDED
@@ -0,0 +1,26 @@
1
+ # 1.5.2以前のBlogkitからのアップデートについて
2
+
3
+ 新しいBlogkitは、最新のtDiaryからサポートされた「スタイル」に対応しました。この結果、旧Blogkitを使っていた場合には、以下の手順で設定を変更してください:
4
+
5
+ 1. 従来のblogio.rbを削除し、新しいblog_style.rbを同じ場所にコピーします。
6
+ 2. tdiary.confの「require 'tdiary/blogio'」を削除し、代わりに「@style = 'Blog'」を追加します。
7
+
8
+ さらに非互換吸収のために、データのコンバートが必要になりました:
9
+
10
+ 3. @data_pathにある*.td2というファイルをすべて見つけてください
11
+ 4. 見つけたファイルをテキストエディタで開き、すべての「Format: tDiary」を「Format: Blog」に置換します。
12
+ 5. ファイルを保存後、@data_path/cacheディレクトリにある*.parserファイルと*.rbファイルを削除してください。
13
+
14
+ もし、上記の方法が実施できないのであれば、以下の方法を代わりに実施してもよいです。
15
+
16
+ 3. blog_style.rbを開いて、以下の行を見つけます。
17
+
18
+ # TDiary::DefaultIO::add_style( 'tDiary', self )
19
+
20
+ 4. この行を以下のように書き換えます(「#」を削除するだけ)。
21
+
22
+ TDiary::DefaultIO::add_style( 'tDiary', self )
23
+
24
+ 5. ファイルを保存し、@data_path/cacheにある*.parserと*.rbを削除します。
25
+
26
+ あとの方法は互換性維持のための逃げ手なので、できれば先の方法をお勧めします。
@@ -0,0 +1,4 @@
1
+ require 'tdiary/blogkit'
2
+ require 'tdiary/style/blog'
3
+ require 'tdiary/style/blogrd'
4
+ require 'tdiary/style/blogwiki'
@@ -0,0 +1,9 @@
1
+ require 'tdiary/extensions/blogkit'
2
+
3
+ module TDiary
4
+ class Blogkit
5
+ def self.root
6
+ File.expand_path('../../..', __FILE__)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module TDiary
2
+ class Blogkit
3
+ VERSION = "5.0.1"
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ module TDiary
2
+ module Extensions
3
+ class Blogkit
4
+ def self.sp_path
5
+ File.join(TDiary::Blogkit.root, 'plugin')
6
+ end
7
+
8
+ def self.assets_path
9
+ File.join(TDiary::Blogkit.root, 'js')
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,123 @@
1
+ # -*- coding: utf-8; -*-
2
+ #
3
+ # blog_style.rb: tDiary blog kit's style $Revision: 1.5 $
4
+ #
5
+ # if you want to use this style, add @style into tdiary.conf below:
6
+ #
7
+ # @style = 'Blog'
8
+ #
9
+ # Copyright (C) 2003, TADA Tadashi <sho@spc.gr.jp>
10
+ # You can distribute this under GPL.
11
+ #
12
+ begin
13
+ # require each classes extended by this file (TDiaryBase, TDiaryForm, TDiaryAppend)
14
+ # because 'tdiary.rb' have not loaded at this point
15
+ require 'tdiary/view_helper'
16
+ require 'tdiary/base'
17
+ require 'tdiary/author_only_base'
18
+ require 'tdiary/admin'
19
+ require 'tdiary/style/tdiary'
20
+ rescue LoadError
21
+ require 'tdiary/tdiary_style'
22
+ end
23
+
24
+ module TDiary
25
+ module Style
26
+ class BlogDiary < TdiaryDiary
27
+ def style
28
+ 'Blog'
29
+ end
30
+
31
+ def to_html4( opt )
32
+ section_id = 0
33
+ r = %Q[<div class="section">\n]
34
+ each_section do |section|
35
+ if section_id > 0 and not opt['anchor'] then
36
+ r << %Q|<p class="readmore"><a href="#{opt['index']}<%=anchor "#{date.strftime( '%Y%m%d' )}"%>">Read more...</a></p>\n|
37
+ break
38
+ end
39
+ if section.subtitle then
40
+ r << %Q[<h3>#{section.subtitle}</h3>\n]
41
+ end
42
+ if /^</ =~ section.body then
43
+ r << %Q[#{section.body}\n]
44
+ else
45
+ r << %Q[<p>#{section.body.lines.collect{|l|l.chomp.sub( /^[  ]/u, '' )}.join( "</p>\n<p>" )}</p>\n]
46
+ end
47
+ section_id += 1
48
+ end
49
+ r << %Q[</div>]
50
+ end
51
+
52
+ def to_chtml( opt )
53
+ r = ''
54
+ each_section do |section|
55
+ if section.subtitle then
56
+ r << %Q[<H3>#{section.subtitle}</H3>]
57
+ end
58
+ if /^</ =~ section.body then
59
+ r << section.body
60
+ else
61
+ r << %Q[<P>#{section.body.lines.collect{|l|l.chomp.sub( /^[  ]/u, '' )}.join( "</P>\n<P>" )}</P>]
62
+ end
63
+ end
64
+ r
65
+ end
66
+ end
67
+ end
68
+
69
+ class TDiaryBase
70
+ protected
71
+ def blog_newdate( date )
72
+ calendar
73
+ year = @years.keys.sort[-1]
74
+ if year then
75
+ month = @years[year].sort[-1]
76
+ if month then
77
+ @io.transaction( Time::local( year.to_i, month.to_i ) ) do |diaries|
78
+ recent = diaries.keys.sort[-1]
79
+ if date.strftime( '%Y%m%d' ) <= recent then
80
+ yield( recent )
81
+ end
82
+ DIRTY_NONE
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
88
+
89
+ class TDiaryForm
90
+ alias eval_rhtml_blogkit eval_rhtml
91
+ def eval_rhtml( prefix = '' )
92
+ if /^blog/i =~ @conf.style then
93
+ blog_newdate( @date ) do |recent|
94
+ @date = Time::local( *recent.scan( /(\d{4})(\d\d)(\d\d)/ )[0] ) + 24*60*60
95
+ @diary = @io.diary_factory( @date, '', '' )
96
+ end
97
+ end
98
+ eval_rhtml_blogkit( prefix )
99
+ end
100
+ end
101
+
102
+ class TDiaryAppend
103
+ protected
104
+ alias newdate_blogkit newdate
105
+ def newdate
106
+ date = nil
107
+ if /^blog/i =~ @conf.style then
108
+ blog_newdate( newdate_blogkit ) do |recent|
109
+ date = Time::local( *recent.scan( /(\d{4})(\d\d)(\d\d)/ )[0] ) + 24*60*60
110
+ end
111
+ end
112
+ date = newdate_blogkit unless date
113
+ date
114
+ end
115
+ end
116
+ end
117
+
118
+ # Local Variables:
119
+ # mode: ruby
120
+ # indent-tabs-mode: t
121
+ # tab-width: 3
122
+ # ruby-indent-level: 3
123
+ # End: