tdiary 4.0.4 → 4.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -3
  3. data/ChangeLog +15 -0
  4. data/Gemfile +2 -2
  5. data/Gemfile.lock +53 -41
  6. data/doc/HOWTO-make-io.md +12 -85
  7. data/doc/INSTALL-paas.md +3 -3
  8. data/doc/INSTALL.md +6 -6
  9. data/misc/lib/fcgi_patch.rb +0 -1
  10. data/misc/migrate.rb +1 -1
  11. data/misc/paas/heroku/Gemfile +1 -0
  12. data/misc/plugin/amazon.rb +1 -1
  13. data/misc/plugin/calendar2.rb +0 -2
  14. data/misc/plugin/calendar3.rb +0 -1
  15. data/misc/plugin/category.rb +0 -6
  16. data/misc/plugin/counter.rb +1 -1
  17. data/misc/plugin/daily_theme.rb +1 -1
  18. data/misc/plugin/disp_referrer.rb +1 -1
  19. data/misc/plugin/edit_today.rb +1 -1
  20. data/misc/plugin/en/edit_today.rb +1 -1
  21. data/misc/plugin/en/hide-mail-field.rb +1 -1
  22. data/misc/plugin/en/weather.rb +3 -1
  23. data/misc/plugin/image.rb +3 -8
  24. data/misc/plugin/ja/edit_today.rb +1 -1
  25. data/misc/plugin/ja/hide-mail-field.rb +1 -1
  26. data/misc/plugin/ja/weather.rb +3 -0
  27. data/misc/plugin/list.rb +1 -1
  28. data/misc/plugin/makerss.rb +2 -3
  29. data/misc/plugin/my-ex.rb +1 -1
  30. data/misc/plugin/ping.rb +2 -2
  31. data/misc/plugin/recent_comment3.rb +1 -1
  32. data/misc/plugin/search-default.rb +1 -2
  33. data/misc/plugin/tlink.rb +1 -1
  34. data/misc/plugin/xmlrpc/xmlrpc.rb +13 -20
  35. data/package.json +4 -4
  36. data/plugin/00default.rb +1 -1
  37. data/plugin/05referer.rb +0 -1
  38. data/plugin/10spamfilter.rb +0 -12
  39. data/plugin/50sp.rb +1 -1
  40. data/plugin/60sf.rb +2 -2
  41. data/plugin/en/00default.rb +3 -4
  42. data/plugin/en/05referer.rb +0 -3
  43. data/plugin/ja/00default.rb +3 -5
  44. data/spec/plugin/bq_spec.rb +1 -1
  45. data/tdiary/base.rb +1 -1
  46. data/tdiary/compatible.rb +1 -1
  47. data/tdiary/core_ext.rb +1 -1
  48. data/tdiary/plugin.rb +1 -1
  49. data/tdiary/referer_manager.rb +1 -1
  50. data/tdiary/style/tdiary.rb +0 -1
  51. data/tdiary/style/wiki.rb +2 -1
  52. data/tdiary/version.rb +1 -1
  53. data/test/weather_test.rb +30 -0
  54. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85434affa0930f2a4e2b50a08b36b97811a57474
4
- data.tar.gz: 375d0121a198b0554ddd87e215b177d704a96c9d
3
+ metadata.gz: 4642bf9547d4b0d837b9ad8ec9c5b8f4eba7ee90
4
+ data.tar.gz: 74b9c0a6377299a3d536248a063c356106032e7e
5
5
  SHA512:
6
- metadata.gz: 076059aba8fca8e10e9e3258270504acd284447072a230cb304735d738f0d4cbb4042685aef25885adb07cb06a11ed69f50becfe08892d5646aef1402af26f14
7
- data.tar.gz: 35c4442fd0f86a3662b7e0e9c3c521061f2bbf4efd883d1d2de71b70ce20df47172a0317e260e0d2e51ff141d1261610c13fb984439fdff07616fd69937a4796
6
+ metadata.gz: c47b2df47b11083280eeb6e7d1e87962052fcf0666308f1297bef22d9645a79cfcbceec02bb84ae0a8471bab989c99a4704fd2d68c26d1b474b86038836f741f
7
+ data.tar.gz: 7ce323d5452bc607759d6f986426946637fd7cff6ad59645cd69265ea52f1fb6d926b74c4a79ce9e16b2a069cac464bba8d142fa9e60f8d83626ef9361337418
data/.travis.yml CHANGED
@@ -11,7 +11,7 @@ rvm:
11
11
  cache: bundler
12
12
 
13
13
  # ignored --deployment option
14
- bundler_args: ""
14
+ bundler_args: "--without server"
15
15
 
16
16
  before_install:
17
17
  - "export DISPLAY=:99.0"
@@ -36,7 +36,6 @@ notifications:
36
36
 
37
37
  matrix:
38
38
  allow_failures:
39
- # eventmachine cann't build with rb_thread_blocking_region
40
- - rvm: ruby-head
41
39
  # webrick mode is unstable results...
42
40
  - env: TEST_MODE=webrick
41
+ - rvm: ruby-head
data/ChangeLog CHANGED
@@ -1,3 +1,18 @@
1
+ 2014-08-29 TADA Tadashi <t@tdtds.jp>
2
+ * release 4.0.5
3
+
4
+ 2014-08-27 zunda <zunda at freeshell.org>
5
+ * plugin/weather.rb: Change Japanese translation for few clouds
6
+
7
+ 2014-08-12 zunda <zunda at freeshell.org>
8
+ * plugin/weather.rb: Change Japanese translation for few clouds
9
+
10
+ 2014-07-25 zunda <zunda at freeshell.org>
11
+ * plugin/weather.rb: Add a Japanese translation to Scattered Clouds
12
+
13
+ 2014-06-14 zunda <zunda at freeshell.org>
14
+ * plugin/weather.rb: Add a translation for `few clouds'
15
+
1
16
  2014-05-29 TADA Tadashi <t@tdtds.jp>
2
17
  * release 4.0.4
3
18
 
data/Gemfile CHANGED
@@ -28,9 +28,9 @@ group :development do
28
28
  gem 'redcarpet'
29
29
 
30
30
  group :test do
31
- gem 'pry'
31
+ gem 'pry-byebug'
32
32
  gem 'test-unit'
33
- gem 'rspec', '~> 3.0.0.beta2'
33
+ gem 'rspec'
34
34
  gem 'capybara', require: 'capybara/rspec'
35
35
  gem 'selenium-webdriver'
36
36
  gem 'launchy'
data/Gemfile.lock CHANGED
@@ -2,7 +2,10 @@ GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
4
  addressable (2.3.6)
5
- capybara (2.2.1)
5
+ byebug (2.7.0)
6
+ columnize (~> 0.3)
7
+ debugger-linecache (~> 1.2)
8
+ capybara (2.4.1)
6
9
  mime-types (>= 1.16)
7
10
  nokogiri (>= 1.3.3)
8
11
  rack (>= 1.0.0)
@@ -11,56 +14,63 @@ GEM
11
14
  childprocess (0.5.3)
12
15
  ffi (~> 1.0, >= 1.0.11)
13
16
  coderay (1.1.0)
14
- coffee-script (2.2.0)
17
+ coffee-script (2.3.0)
15
18
  coffee-script-source
16
19
  execjs
17
- coffee-script-source (1.7.0)
18
- coveralls (0.7.0)
20
+ coffee-script-source (1.7.1)
21
+ columnize (0.8.9)
22
+ coveralls (0.7.1)
19
23
  multi_json (~> 1.3)
20
24
  rest-client
21
25
  simplecov (>= 0.7)
22
26
  term-ansicolor
23
27
  thor
24
28
  daemons (1.1.9)
29
+ debugger-linecache (1.2.0)
25
30
  diff-lcs (1.2.5)
26
- docile (1.1.3)
31
+ docile (1.1.5)
27
32
  eventmachine (1.0.3)
28
- execjs (2.0.2)
33
+ execjs (2.2.1)
29
34
  faraday (0.9.0)
30
35
  multipart-post (>= 1.2, < 3)
31
- fastimage (1.6.2)
36
+ fastimage (1.6.3)
32
37
  addressable (~> 2.3, >= 2.3.5)
33
38
  ffi (1.9.3)
34
39
  hike (1.2.3)
35
40
  hikidoc (0.1.0)
36
- hub (1.12.0)
37
- jasmine (2.0.1)
41
+ hub (1.12.2)
42
+ jasmine (2.0.2)
38
43
  jasmine-core (~> 2.0.0)
39
44
  phantomjs
40
45
  rack (>= 1.2.1)
41
46
  rake
42
- jasmine-core (2.0.0)
47
+ jasmine-core (2.0.1)
43
48
  launchy (2.4.2)
44
49
  addressable (~> 2.3)
45
50
  libv8 (3.16.14.3)
46
51
  method_source (0.8.2)
47
- mime-types (2.2)
52
+ mime-types (2.3)
48
53
  mini_portile (0.6.0)
49
- multi_json (1.10.0)
54
+ multi_json (1.10.1)
50
55
  multipart-post (2.0.0)
51
- nokogiri (1.6.2.1)
56
+ netrc (0.7.7)
57
+ nokogiri (1.6.3.1)
52
58
  mini_portile (= 0.6.0)
53
- octokit (3.1.0)
59
+ octokit (3.3.1)
54
60
  sawyer (~> 0.5.3)
55
61
  octorelease (0.0.6)
56
62
  hub
57
63
  octokit
58
- phantomjs (1.9.7.0)
64
+ phantomjs (1.9.7.1)
59
65
  pit (0.0.7)
60
- pry (0.9.12.6)
61
- coderay (~> 1.0)
62
- method_source (~> 0.8)
66
+ power_assert (0.1.3)
67
+ pry (0.10.1)
68
+ coderay (~> 1.1.0)
69
+ method_source (~> 0.8.1)
63
70
  slop (~> 3.4)
71
+ pry-byebug (1.3.3)
72
+ byebug (~> 2.7)
73
+ pry (~> 0.10)
64
74
  rack (1.5.2)
65
75
  rack-test (0.6.2)
66
76
  rack (>= 1.0)
@@ -70,36 +80,37 @@ GEM
70
80
  rake (10.3.2)
71
81
  redcarpet (3.1.2)
72
82
  ref (1.0.5)
73
- rest-client (1.6.7)
74
- mime-types (>= 1.16)
75
- rspec (3.0.0.rc1)
76
- rspec-core (= 3.0.0.rc1)
77
- rspec-expectations (= 3.0.0.rc1)
78
- rspec-mocks (= 3.0.0.rc1)
79
- rspec-core (3.0.0.rc1)
80
- rspec-support (= 3.0.0.rc1)
81
- rspec-expectations (3.0.0.rc1)
83
+ rest-client (1.7.2)
84
+ mime-types (>= 1.16, < 3.0)
85
+ netrc (~> 0.7)
86
+ rspec (3.0.0)
87
+ rspec-core (~> 3.0.0)
88
+ rspec-expectations (~> 3.0.0)
89
+ rspec-mocks (~> 3.0.0)
90
+ rspec-core (3.0.4)
91
+ rspec-support (~> 3.0.0)
92
+ rspec-expectations (3.0.4)
82
93
  diff-lcs (>= 1.2.0, < 2.0)
83
- rspec-support (= 3.0.0.rc1)
84
- rspec-mocks (3.0.0.rc1)
85
- rspec-support (= 3.0.0.rc1)
86
- rspec-support (3.0.0.rc1)
87
- rubyzip (1.1.3)
88
- sawyer (0.5.4)
94
+ rspec-support (~> 3.0.0)
95
+ rspec-mocks (3.0.4)
96
+ rspec-support (~> 3.0.0)
97
+ rspec-support (3.0.4)
98
+ rubyzip (1.1.6)
99
+ sawyer (0.5.5)
89
100
  addressable (~> 2.3.5)
90
101
  faraday (~> 0.8, < 0.10)
91
- selenium-webdriver (2.41.0)
102
+ selenium-webdriver (2.42.0)
92
103
  childprocess (>= 0.5.0)
93
104
  multi_json (~> 1.0)
94
105
  rubyzip (~> 1.0)
95
106
  websocket (~> 1.0.4)
96
- sequel (4.10.0)
97
- simplecov (0.8.2)
107
+ sequel (4.13.0)
108
+ simplecov (0.9.0)
98
109
  docile (~> 1.1.0)
99
110
  multi_json
100
111
  simplecov-html (~> 0.8.0)
101
112
  simplecov-html (0.8.0)
102
- slop (3.5.0)
113
+ slop (3.6.0)
103
114
  sprockets (2.12.1)
104
115
  hike (~> 1.2)
105
116
  multi_json (~> 1.0)
@@ -108,7 +119,8 @@ GEM
108
119
  sqlite3 (1.3.9)
109
120
  term-ansicolor (1.3.0)
110
121
  tins (~> 1.0)
111
- test-unit (2.5.5)
122
+ test-unit (3.0.1)
123
+ power_assert
112
124
  therubyracer (0.12.1)
113
125
  libv8 (~> 3.16.14.0)
114
126
  ref
@@ -118,7 +130,7 @@ GEM
118
130
  rack (>= 1.0.0)
119
131
  thor (0.19.1)
120
132
  tilt (1.4.1)
121
- tins (1.3.0)
133
+ tins (1.3.1)
122
134
  websocket (1.0.7)
123
135
  xpath (2.0.0)
124
136
  nokogiri (~> 1.3)
@@ -136,12 +148,12 @@ DEPENDENCIES
136
148
  launchy
137
149
  octorelease
138
150
  pit
139
- pry
151
+ pry-byebug
140
152
  rack
141
153
  racksh
142
154
  rake
143
155
  redcarpet
144
- rspec (~> 3.0.0.beta2)
156
+ rspec
145
157
  selenium-webdriver
146
158
  sequel
147
159
  simplecov
data/doc/HOWTO-make-io.md CHANGED
@@ -13,21 +13,24 @@ IOクラス
13
13
 
14
14
  ### IOBaseクラス
15
15
 
16
- tdiary.rbにはTDiary::IOBaseというクラスが定義されており、これを継承 して独自のIOクラスを作成します。下記の例は、HogeIOを定義しています。
16
+ tdiary.rbにはTDiary::IOBaseというクラスが定義されており、これを継承 して独自のIOクラスを作成します。下記の例は、Tdiary::IO::Hogeを定義しています。
17
17
 
18
18
  ```
19
- class HogeIO < TDiary::IOBase
20
- def calendar
21
- .....
19
+ module TDiary
20
+ module IO
21
+ class Hoge < Base
22
+ def calendar
23
+ .....
24
+ end
25
+ .....
26
+ end
22
27
  end
23
-
24
- .....
25
28
  end
26
29
  ```
27
30
 
28
31
  ### 最低限実装すべきもの
29
32
 
30
- IOBaseクラスにはIOクラスに共通ないくつかのメソッドがすでに実装してあ ります。これを継承したIOクラスでは、さらに以下のようなメソッドを実装 しなくてはいけません。
33
+ TDiary::IO::BaseクラスにはIOクラスに共通ないくつかのメソッドがすでに実装してあ ります。これを継承したIOクラスでは、さらに以下のようなメソッドを実装 しなくてはいけません。
31
34
 
32
35
  #### calendar
33
36
  tDiaryに、日記が存在する年月を通知するためのメソッドです。実行時にtDiary から呼び出されます。
@@ -74,31 +77,6 @@ def trasaction( date )
74
77
  end
75
78
  ```
76
79
 
77
- #### diary\_factory( date, title, body, style = 'tDiary' )
78
- diary\_factoryは、指定されたフォーマットの日記オブジェクトを生成して 返します。
79
-
80
- 引数dateは日付(Stringで8桁)を指定します。title、bodyはそれぞれ生成す る日記のタイトルと本文です(String)。styleは日記の記述形式を指定する 文字列で、diary\_factoryに依存します。
81
-
82
- 返り値はDiaryBaseをincludeした継承したクラスのオブジェクトです。
83
-
84
- 以下にdiary\_factoryの例を示します。
85
-
86
- ```
87
- def diary_factory( date, title, body, style = 'tDiary' )
88
- case style
89
- when 'tDiary' DefaultDiary::new( date, title, body )
90
- default raise StandardError, 'bad style'
91
- end
92
- end
93
- ```
94
-
95
- もし、スタイルに対応したIOクラスを作るなら、initializeでload\_styleを 呼んだ上で、以下のようにstyled\_diary\_factoryを呼ぶだけで良いです。
96
-
97
- ```
98
- def diary_factory( date, title, body, style = 'tDiary' )
99
- styled_diary_factory( date, title, body, style )
100
- end
101
- ```
102
80
 
103
81
  日記データ
104
82
  -----
@@ -145,43 +123,15 @@ end
145
123
  もし、この日記データをスタイルとして設計するのであれば、IOクラスとは 分離して、別のファイルにする必要があります。この場合、スタイル名と ファイル名、日記データクラス名には強い依存性があります。「Hoge」という スタイルを作る場合、以下のように作る必要があります。
146
124
 
147
125
  - スタイル名: Hoge
148
- - ファイル名: hoge\_style.rb
149
- - クラス名 : TDiary::HogeDiary (スタイル名.capitalize + 'Diary')
150
-
151
- ### DiaryBaseモジュール
152
-
153
- tdiary.rbにはDiaryBaseというモジュールが定義されており、 日記データのクラスはこのモジュールをincludeしなければなりません。
154
-
155
- 下記の例はHogeDiaryにDiaryBaseをincludeしています。
156
-
157
- ```
158
- class HogeDiary
159
- include DiaryBase
160
- .....
161
- end
162
- ```
163
-
164
- ### CategorizableDiary/UncategorizableDiaryモジュール
165
-
166
- tdiary.rbにはCategorizableDiaryとUncategorizableDiaryというモジュールが定義されています。 日記データのクラスは、カテゴリ機能に対応している場合はCategorizableDiaryモジュールを、 カテゴリ機能に対応していない場合はUncategorizableDiaryモジュールを includeしなければなりません。
167
-
168
- 下記の例はHogeDiaryにCategoriabeleDiaryをincludeしています。
169
-
170
- ```
171
- class HogeDiary
172
- include CategorizableDiary
173
- .....
174
- end
175
- ```
126
+ - ファイル名: style/hoge.rb
127
+ - クラス名 : TDiary::Style::HogeDiary (スタイル名.capitalize + 'Diary')
176
128
 
177
129
  ### 最低限実装すべきもの
178
130
 
179
131
  DiaryBaseモジュールには日記データのクラスに必要な幾つかのメソッドが 定義されています。DiaryBaseで定義されているメソッド以外に 日記データのクラスが備えるべきメソッドは下記のものになります。 (ここでいうメソッドは Public Instance Method のことです。)
180
132
 
181
133
  - initialize
182
- - replace
183
134
  - append
184
- - each\_section
185
135
  - to\_html
186
136
  - to\_src
187
137
  - style
@@ -197,7 +147,6 @@ DiaryBaseモジュールには日記データのクラスに必要な幾つか
197
147
 
198
148
  ```
199
149
  class HogeDiary
200
- include DiaryBase
201
150
  .....
202
151
  def initialize(date, title, body, modified = Time::now)
203
152
  init_diary
@@ -207,16 +156,6 @@ class HogeDiary
207
156
  end
208
157
  ```
209
158
 
210
- #### replace(date, title, body)
211
- 日記データの日付をdateに、日記本文のソースをbodyに、タイトルをtitleに変更します。 dateはTimeオブジェクト、もしくは、日付をあらわす文字列('YYYYMMDD')です。 日付を表す文字列は具体的には下のようになります。
212
-
213
- - '20020831'
214
- - '20010101'
215
-
216
- body, titleは文字列です。
217
-
218
- 日記本文が変更された場合、日記本文を解釈し直す必要があります。 解釈し直す時には日記データを構成するセクションも変更されます。
219
-
220
159
  #### append(body, author = nil)
221
160
  日記本文を追加します。bodyは追加される日記本文です。 authorは日記を記述した人の名前で、文字列です。 authorの引数はデフォルトでnilにしなければなりません。
222
161
 
@@ -239,18 +178,6 @@ class HogeDiary
239
178
  end
240
179
  ```
241
180
 
242
- #### to\_html(opt, mode = :HTML)
243
- 日記データをHTMLに変換します。引数optは設定ファイル(tdiary.conf)の内容の一部を 保持するHashオブジェクトです。引数modeはSymbolオブジェクトで、 現在は下記のいずれかです。
244
-
245
- - :HTML
246
- - :CHTML
247
-
248
- 想定しないmodeが指定された場合は、:HTMLが指定されたものとみなして下 さい。:HTMLの場合は通常のブラウザ用にHTMLに、:CHTMLの場合は携帯端末 用にcHTMLに変換しなければなりません。
249
-
250
- optの内容によって、日記のリンク先を変更しなければならないので、注意 が必要です。
251
-
252
- カテゴリ機能に対応した日記データのクラスでは、 各セクションのサブタイトル中のカテゴリ指定をcategory\_anchorプラグインの呼出しに変換して下さい。
253
-
254
181
  #### to\_src
255
182
  日記の本文を返します。
256
183
 
data/doc/INSTALL-paas.md CHANGED
@@ -57,7 +57,7 @@ heroku コマンドを用いて Heroku でアプリケーションを作成し
57
57
  日記更新時に必要となるユーザー名とパスワードを保存する .htpasswd ファイルを作成します。この情報は重要なので、外部には公開しないでください。
58
58
 
59
59
  ```
60
- % bundle exec rake auth:password:create
60
+ % bundle exec bin/tdiary htpasswd
61
61
  ```
62
62
 
63
63
  ここまでの変更内容を deploy ブランチにコミットし、Heroku にアプリケーションを転送します。
@@ -198,9 +198,9 @@ gem 'dalli'
198
198
  tdiary.conf を以下のように変更します。
199
199
 
200
200
  ```
201
- # require 'tdiary/io/cache/file'
201
+ # require 'tdiary/cache/file'
202
202
  # To use memcache addon
203
- require 'tdiary/io/cache/memcached'
203
+ require 'tdiary/cache/memcached'
204
204
  ```
205
205
 
206
206
  この状態を Heroku に反映させます。
data/doc/INSTALL.md CHANGED
@@ -33,20 +33,20 @@ tDiary は日記データのキャッシュを PStore ファイルとして保
33
33
 
34
34
  ```
35
35
  # 以下の行をコメントアウト
36
- # require 'tdiary/io/cache/file'
37
- require 'tdiary/io/cache/memcached'
36
+ # require 'tdiary/cache/file'
37
+ require 'tdiary/cache/memcached'
38
38
  require 'tdiary/io/default'
39
- @io_class = DefaultIO
39
+ @io_class = TDiary::IO::Default
40
40
  ```
41
41
 
42
42
  同様に redis を使用する場合は tdiary.conf を以下のように変更します。
43
43
 
44
44
  ```
45
45
  # 以下の行をコメントアウト
46
- # require 'tdiary/io/cache/file'
47
- require 'tdiary/io/cache/redis'
46
+ # require 'tdiary/cache/file'
47
+ require 'tdiary/cache/redis'
48
48
  require 'tdiary/io/default'
49
- @io_class = DefaultIO
49
+ @io_class = TDiary::IO::Default
50
50
  ```
51
51
 
52
52
  #### CGIで設定できない項目
@@ -67,7 +67,6 @@ class FCGI
67
67
  if FCGI::is_cgi?
68
68
  yield ::CGI.new(*args)
69
69
  else
70
- exit_requested = false
71
70
  FCGI::each {|request|
72
71
  $stdout, $stderr = request.out, request.err
73
72
 
data/misc/migrate.rb CHANGED
@@ -126,7 +126,7 @@ begin
126
126
  end
127
127
 
128
128
  @cgi = CGI::new
129
- conf = TDiary::MigrateConfig::new(@cgi)
129
+ TDiary::MigrateConfig::new(@cgi)
130
130
 
131
131
  print @cgi.header( 'status' => '200 OK', 'type' => 'text/html' )
132
132
  puts "<h1>Migration completed.</h1>"
@@ -14,6 +14,7 @@ gem 'omniauth-github'
14
14
  gem 'thin', require: false
15
15
  gem 'tdiary-io-rdb'
16
16
  gem 'pg'
17
+ gem 'thor'
17
18
 
18
19
  # To use memcached for Cache
19
20
  # gem 'tdiary-cache-memcached'
@@ -170,7 +170,7 @@ def amazon_detail_html( item )
170
170
  @conf['amazon.imgsize'] = size_orig
171
171
 
172
172
  url = amazon_url( item )
173
- html = <<-HTML
173
+ <<-HTML
174
174
  <a class="amazon-detail" href="#{url}"><span class="amazon-detail">
175
175
  <img class="amazon-detail left" src="#{h image[:src]}"
176
176
  height="#{h image[:height]}" width="#{h image[:width]}"
@@ -72,8 +72,6 @@ def calendar2_make_anchor(ym, str)
72
72
  end
73
73
 
74
74
  def calender2_make_image(diary, date)
75
- f_list = []
76
-
77
75
  /[^_]image(?:_left|_right|_gps)?\s*\(?\s*([0-9]*)\s*\,?\s*'[^']*'/ =~ diary.to_s
78
76
  if $1 == nil
79
77
  return nil
@@ -141,7 +141,6 @@ def calendar3
141
141
  end
142
142
  year = date.year
143
143
  month = date.month
144
- day = date.day
145
144
 
146
145
  result << %Q|<span class="calendar-prev-month"><a href="#{h @index}#{anchor "%04d%02d" % Calendar3.prev_month(year, month)}">&lt;&lt;</a></span>\n|
147
146
  result << %Q|<span class="calendar-current-month"><a href="#{h @index}#{anchor "%04d%02d" % [year, month]}">#{"%04d/%02d" % [year, month]}</a>/</span>\n|
@@ -105,8 +105,6 @@ end
105
105
 
106
106
  def category_list_sections
107
107
  info = Category::Info.new(@cgi, @years, @conf)
108
- category = info.category
109
- years = info.years
110
108
  r = ''
111
109
 
112
110
  raise ::TDiary::NotFound if @categorized.empty? and bot?
@@ -141,8 +139,6 @@ end
141
139
 
142
140
  def category_list_sections_mobile
143
141
  info = Category::Info.new(@cgi, @years, @conf)
144
- category = info.category
145
- years = info.years
146
142
  r = ''
147
143
 
148
144
  raise ::TDiary::NotFound if @categorized.empty? and bot?
@@ -496,7 +492,6 @@ class Cache
496
492
  ym = "#{y}#{m}"
497
493
  cgi.params['date'] = [ym]
498
494
  m = TDiaryMonth.new(cgi, '', @conf)
499
- sections = {}
500
495
  m.diaries.each do |ymd, diary|
501
496
  next if !diary.visible?
502
497
  initial_replace_sections(diary)
@@ -699,7 +694,6 @@ end
699
694
 
700
695
  if @mode == 'conf' || @mode == 'saveconf'
701
696
  add_conf_proc( 'category', @category_conf_label, 'basic' ) do
702
- cache = @category_cache
703
697
  if @mode == 'saveconf'
704
698
  if @cgi.valid?( 'category_initialize' )
705
699
  @category_cache.recreate(@years)
@@ -494,7 +494,7 @@ TOPLEVEL_CLASS
494
494
  msg = @options["counter.kiriban_today_msg"] ? @options["counter.kiriban_today_msg"] : ""
495
495
  ERB.new(msg.untaint).result(binding)
496
496
  else
497
- msg = @options["counter.kiriban_nomatch_msg"] ? @options["counter.kiriban_nomatch_msg"] : ""
497
+ @options["counter.kiriban_nomatch_msg"] ? @options["counter.kiriban_nomatch_msg"] : ""
498
498
  end
499
499
  end
500
500
  end
@@ -40,7 +40,7 @@ def daily_theme_conf_proc
40
40
  # initialize Theme list
41
41
  @conf['daily_theme.list'] = "default" unless @conf['daily_theme.list']
42
42
 
43
- result = <<-HTML
43
+ <<-HTML
44
44
  <h3>#{@daily_theme_label}</h3>
45
45
  <p>#{@daily_theme_label_desc}</p>
46
46
  <p><textarea name="daily_theme.list" cols="70" rows="20">#{h( @conf['daily_theme.list'] )}</textarea></p>
@@ -1040,7 +1040,7 @@ class DispRef2Refs
1040
1040
  end
1041
1041
  result << "</li>\n"
1042
1042
  end
1043
- rescue Encoding::CompatibilityError => e
1043
+ rescue Encoding::CompatibilityError
1044
1044
  end
1045
1045
  end
1046
1046
  result << "</ul>\n"
@@ -17,7 +17,7 @@ def edit_today_link( date, title )
17
17
  edit_today_init
18
18
  caption = @conf['edit_today.caption']
19
19
  unless @cgi.mobile_agent?
20
- r = <<-HTML
20
+ <<-HTML
21
21
  #{title}\n<span class="edit-today">
22
22
  <a href="#{@update}?edit=true;#{date.strftime( 'year=%Y;month=%m;day=%d' )}" title="#{edit_today_edit_label( date )}" rel="nofollow">#{caption}</a>
23
23
  </span>
@@ -7,7 +7,7 @@ def edit_today_edit_label( date )
7
7
  end
8
8
 
9
9
  def edit_today_conf_html
10
- r = <<-HTML
10
+ <<-HTML
11
11
  <h3 class="subtitle">Link String</h3>
12
12
  <p>Specify string to link to edit page. If you have image file, you can specify icon on this link.</p>
13
13
  <p><input name="edit_today_caption" size="70" value="#{h @conf['edit_today.caption']}"></p>
@@ -3,7 +3,7 @@
3
3
  @hide_mail_field_label_conf = 'Hide Mail Field'
4
4
 
5
5
  def hide_mail_field_conf_html
6
- r = <<-HTML
6
+ <<-HTML
7
7
  <h3>Description of TSUKKOMI</h3>
8
8
  <p>Show messeges about hidden of E-mail field for your subscribers. This field is as same as in default spam filter preferences.<br>
9
9
  <textarea name="comment_description" cols="60" rows="5">#{h comment_description}</textarea></p>
@@ -39,7 +39,9 @@ We want Japanese displayed in a diary written in Japanese.
39
39
  require 'erb'
40
40
 
41
41
  class Weather
42
- Words_en = []
42
+ Words_en = [
43
+ [%r[\Aunknown\z]i, '""'],
44
+ ]
43
45
  end
44
46
 
45
47
  =begin
data/misc/plugin/image.rb CHANGED
@@ -86,7 +86,7 @@ def image( id, alt = 'image', thumbnail = nil, size = nil, place = 'photo' )
86
86
  size = %Q| width="#{size.to_i}"|
87
87
  end
88
88
  elsif @image_maxwidth and not @conf.secure then
89
- t, w, h = image_info( "#{@image_dir}/#{image}".untaint )
89
+ _, w, _ = image_info( "#{@image_dir}/#{image}".untaint )
90
90
  if w > @image_maxwidth then
91
91
  size = %Q[ width="#{h @image_maxwidth}"]
92
92
  else
@@ -235,16 +235,11 @@ add_form_proc do |date|
235
235
  images.each_with_index do |img,id|
236
236
  next unless img
237
237
  if @conf.secure then
238
- img_type, img_w, img_h = 'jpg', nil, nil
238
+ img_w, img_h = nil, nil
239
239
  else
240
- img_type, img_w, img_h = image_info(File.join(@image_dir,img).untaint)
240
+ _, img_w, img_h = image_info(File.join(@image_dir,img).untaint)
241
241
  end
242
242
  r << %Q[<td><img id="image-index-#{id}" class="image-img form" src="#{h @image_url}/#{h img}" alt="#{id}" width="#{h( (img_w && img_w > 160) ? 160 : (img_w ? img_w : 160) )}"></td>]
243
- if @conf.secure then
244
- img_info = ''
245
- else
246
- img_info = "#{File.size(File.join(@image_dir,img).untaint).to_s.reverse.gsub( /\d{3}/, '\0,' ).sub( /,$/, '' ).reverse} bytes"
247
- end
248
243
  img_info = ''
249
244
  if img_w && img_h
250
245
  img_info << %Q|<span class="image-width">#{img_w}</span> x <span class="image-height">#{img_h}</span>|
@@ -8,7 +8,7 @@ def edit_today_edit_label( date )
8
8
  end
9
9
 
10
10
  def edit_today_conf_html
11
- r = <<-HTML
11
+ <<-HTML
12
12
  <h3 class="subtitle">リンク文字列</h3>
13
13
  <p>編集ページへのリンクを示す文字列を指定します。画像が用意できれば、アイコンなども指定出来ます。</p>
14
14
  <p><input name="edit_today_caption" size="70" value="#{h @conf['edit_today.caption']}"></p>
@@ -4,7 +4,7 @@
4
4
  @hide_mail_field_label_conf = 'メール欄隠し'
5
5
 
6
6
  def hide_mail_field_conf_html
7
- r = <<-HTML
7
+ <<-HTML
8
8
  <h3>ツッコミの注意文</h3>
9
9
  <p>ツッコミフォームの上に表示する注意文を設定します。メール欄が消えていることを読者にきちんと知らせましょう。この欄は標準spamフィルタの設定ページにあるものと同じものです。<br>
10
10
  <textarea name="comment_description" cols="70" rows="5">#{h comment_description}</textarea><br>
@@ -239,6 +239,7 @@ class Weather
239
239
  [%r[\s*\bclear\b\s*]i, '"快晴"'],
240
240
  [%r[\s*\b(mostly |partly )?cloudy\b\s*]i, '"曇"'],
241
241
  [%r[\s*\bbroken clouds\b\s*]i, '"曇"'],
242
+ [%r[\s*\bfew clouds\b\s*]i, '"晴"'],
242
243
  [%r[\s*\bovercast( cloud deck)?\b\s*]i, '"曇"'],
243
244
  [%r[\s*\blight snow showers?\b\s*]i, '"にわか雪"'],
244
245
  [%r[\s*\blight snow\b\s*]i, '"小雪"'],
@@ -258,7 +259,9 @@ class Weather
258
259
  [%r[\s*\blightning\b\s*]i, '"稲光"'],
259
260
  [%r[\s*\bsand\b\s*]i, '"黄砂"'],
260
261
  [%r[\s*\bcumulonimbus clouds\b\s*]i, '"積乱雲"'],
262
+ [%r[\s*\bscattered clouds\b\s*]i, '"ちぎれ雲"'],
261
263
  [%r[\s*\bcumulus clouds\b\s*]i, '"積雲"'],
264
+ [%r[\Aunknown\z]i, '""'],
262
265
  [%r[\s*\btowering\b\s*]i, '""'],
263
266
  [%r[\s*\bobserved\b\s*]i, '""'],
264
267
  [%r[\s*\bC\b\s*], '"℃"'],
data/misc/plugin/list.rb CHANGED
@@ -28,7 +28,7 @@ def li( text )
28
28
  text.each_line do |line|
29
29
  list << ("<li>" + line.chomp + "</li>")
30
30
  end
31
- result = list
31
+ list
32
32
  end
33
33
 
34
34
 
@@ -287,7 +287,7 @@ def makerss_header( uri )
287
287
  copyright += " <#{@conf.author_mail}>" if @conf.author_mail and not @conf.author_mail.empty?
288
288
  copyright += ", copyright of comments by respective authors"
289
289
 
290
- xml = %Q[<?xml version="1.0" encoding="UTF-8"?>
290
+ %Q[<?xml version="1.0" encoding="UTF-8"?>
291
291
  <?xml-stylesheet href="rss.css" type="text/css"?>
292
292
  <rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:xhtml="http://www.w3.org/1999/xhtml" xml:lang="#{h @conf.html_lang}">
293
293
  <channel rdf:about="#{h rdf_url}">
@@ -342,7 +342,6 @@ def makerss_body( uri, rdfsec )
342
342
 
343
343
  @makerss_in_feed = true
344
344
  subtitle = rdfsec.section.subtitle_to_html
345
- sec_id = rdfsec.id[9,2].to_i
346
345
  body_enter = body_enter_proc( date )
347
346
  body = apply_plugin( rdfsec.section.body_to_html )
348
347
  body_leave = body_leave_proc( date )
@@ -445,7 +444,7 @@ add_edit_proc do
445
444
  else
446
445
  ''
447
446
  end
448
- r = <<-HTML
447
+ <<-HTML
449
448
  <div class="makerss"><label for="makerss_update">
450
449
  <input type="checkbox" id="makerss_update" name="makerss_update" value="false"#{checked} tabindex="390">
451
450
  #{@makerss_edit_label}
data/misc/plugin/my-ex.rb CHANGED
@@ -43,7 +43,7 @@ def my( a, str, title = nil )
43
43
  tb = nil
44
44
  @diaries[date].each_visible_trackback( frag.to_i ) {|t, idx| tb = t}
45
45
  if tb then
46
- url, name, tbtitle, excerpt = tb.body.split( /\n/,4 )
46
+ _, name, _, excerpt = tb.body.split( /\n/,4 )
47
47
  title = h( "[#{name}] #{@conf.shorten( excerpt, @conf.comment_length )}" )
48
48
  end
49
49
  end
data/misc/plugin/ping.rb CHANGED
@@ -64,7 +64,7 @@ def ping_conf_proc
64
64
  @conf['ping.list'] = '' unless @conf['ping.list']
65
65
  @conf['ping.timeout'] = '3' unless @conf['ping.timeout']
66
66
 
67
- result = <<-HTML
67
+ <<-HTML
68
68
  <h3>#{@ping_label_list}</h3>
69
69
  <p>#{@ping_label_list_desc}</p>
70
70
  <p><textarea name="ping.list" cols="70" rows="5">#{h( @conf['ping.list'] )}</textarea></p>
@@ -82,7 +82,7 @@ def ping_edit_proc
82
82
  if @mode == 'preview' then
83
83
  checked = @cgi.params['plugin_ping_send'][0] == 'true' ? ' checked' : ''
84
84
  end
85
- r = <<-HTML
85
+ <<-HTML
86
86
  <div class="ping"><label for="plugin_ping_send">
87
87
  <input type="checkbox" id="plugin_ping_send" name="plugin_ping_send" value="true"#{checked} tabindex="400">
88
88
  #{@ping_label_send}
@@ -158,7 +158,7 @@ add_update_proc do
158
158
  db['comments'].each do |c|
159
159
  break if c.nil?
160
160
 
161
- comment, cdate, serial = c
161
+ comment, cdate, _ = c
162
162
  next if cdate.strftime('%Y%m%d') != date
163
163
 
164
164
  if comment == dcomment && comment.date.to_s == dcomment.date.to_s
@@ -222,7 +222,7 @@ module DefaultIOSearch
222
222
  end
223
223
 
224
224
  def search_input_form( q )
225
- r = <<-HTML
225
+ <<-HTML
226
226
  <form method="GET" action="#{@conf.index}"><div>
227
227
  検索キーワード:
228
228
  <input name="q" value="#{h q}">
@@ -237,7 +237,6 @@ def search_result
237
237
  end
238
238
 
239
239
  query = CGI::unescape( @cgi.params['q'][0] )
240
- start = CGI::unescape( @cgi.params['start'][0] || '0' ).to_i
241
240
 
242
241
  begin
243
242
  patterns = DefaultIOSearch::setup_patterns(query)
data/misc/plugin/tlink.rb CHANGED
@@ -75,7 +75,7 @@ def tlink_initialize
75
75
  @tlink_path = dir + "/tlink.dat"
76
76
 
77
77
  Dir.mkdir(dir, 0700) unless FileTest.exist?(dir)
78
- db = PStore.new(@tlink_path).transaction do |db|
78
+ PStore.new(@tlink_path).transaction do |db|
79
79
  if (db.root?('tlinkdata')) then
80
80
  @tlink_dic = db["tlinkdata"]
81
81
  else
@@ -54,10 +54,9 @@ server.add_handler('blogger.newPost') do |appkey, blogid, username, password, co
54
54
  @cgi.params['day'] = [postid[6..7]]
55
55
  @cgi.params['body'] = [src]
56
56
  @cgi.params['csrf_protection_key'] = [@conf.options['csrf_protection_key']]
57
- tdiary = ::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
58
- body = tdiary.eval_rhtml
57
+ ::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
59
58
  postid + "%02d" % index
60
- rescue ::TDiary::ForceRedirect => redirect
59
+ rescue ::TDiary::ForceRedirect
61
60
  postid + "%02d" % index
62
61
  end
63
62
  else
@@ -100,10 +99,9 @@ server.add_handler('blogger.editPost') do |appkey, postid, username, password, c
100
99
  @cgi.params['day'] = [postid[6..7]]
101
100
  @cgi.params['body'] = [src]
102
101
  @cgi.params['csrf_protection_key'] = [@conf.options['csrf_protection_key']]
103
- tdiary = ::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
104
- body = tdiary.eval_rhtml
102
+ ::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
105
103
  true
106
- rescue ::TDiary::ForceRedirect => redirect
104
+ rescue ::TDiary::ForceRedirect
107
105
  true
108
106
  rescue Exception
109
107
  raise XMLRPC::FaultException.new(1,$!.to_s + "\n" + $!.backtrace.join("\n"))
@@ -136,10 +134,9 @@ server.add_handler('blogger.deletePost') do |appkey, postid, username, password|
136
134
  @cgi.params['day'] = [postid[6..7]]
137
135
  @cgi.params['body'] = [src]
138
136
  @cgi.params['csrf_protection_key'] = [@conf.options['csrf_protection_key']]
139
- tdiary = ::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
140
- body = tdiary.eval_rhtml
137
+ ::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
141
138
  true
142
- rescue ::TDiary::ForceRedirect => redirect
139
+ rescue ::TDiary::ForceRedirect
143
140
  true
144
141
  rescue Exception
145
142
  raise XMLRPC::FaultException.new(1,$!.to_s + "\n" + $!.backtrace.join("\n"))
@@ -229,10 +226,9 @@ server.add_handler('metaWeblog.newPost') do |blogid, username, password, content
229
226
  @cgi.params['day'] = [postid[6..7]]
230
227
  @cgi.params['body'] = [src]
231
228
  @cgi.params['csrf_protection_key'] = [@conf.options['csrf_protection_key']]
232
- tdiary = ::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
233
- body = tdiary.eval_rhtml
229
+ ::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
234
230
  postid + "%02d" % index
235
- rescue ::TDiary::ForceRedirect => redirect
231
+ rescue ::TDiary::ForceRedirect
236
232
  postid + "%02d" % index
237
233
  end
238
234
  end
@@ -271,10 +267,9 @@ server.add_handler('metaWeblog.editPost') do |postid, username, password, conten
271
267
  @cgi.params['day'] = [postid[6..7]]
272
268
  @cgi.params['body'] = [src]
273
269
  @cgi.params['csrf_protection_key'] = [@conf.options['csrf_protection_key']]
274
- tdiary = ::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
275
- body = tdiary.eval_rhtml
270
+ ::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
276
271
  true
277
- rescue ::TDiary::ForceRedirect => redirect
272
+ rescue ::TDiary::ForceRedirect
278
273
  true
279
274
  rescue Exception
280
275
  raise XMLRPC::FaultException.new(1,$!.to_s + "\n" + $!.backtrace.join("\n"))
@@ -415,7 +410,6 @@ server.add_handler('mt.getCategoryList') do |blogid, username, password|
415
410
  ym = "#{y}#{m}"
416
411
  @cgi.params['date'] = [ym]
417
412
  m = ::TDiary::TDiaryMonth.new(@cgi, '', @conf)
418
- sections = {}
419
413
  m.diaries.each do |ymd, diary|
420
414
  next if !diary.visible?
421
415
  diary.each_section do |s|
@@ -503,10 +497,9 @@ server.add_handler('mt.setPostCategories') do |postid, username, password, categ
503
497
  @cgi.params['day'] = [postid[6..7]]
504
498
  @cgi.params['body'] = [src]
505
499
  @cgi.params['csrf_protection_key'] = [@conf.options['csrf_protection_key']]
506
- tdiary = ::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
507
- body = tdiary.eval_rhtml
500
+ ::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
508
501
  true
509
- rescue ::TDiary::ForceRedirect => redirect
502
+ rescue ::TDiary::ForceRedirect
510
503
  true
511
504
  rescue Exception
512
505
  raise XMLRPC::FaultException.new(1,$!.to_s + "\n" + $!.backtrace.join("\n"))
@@ -546,7 +539,7 @@ server.add_handler('mt.getTrackbackPings') do |postid|
546
539
  result = []
547
540
  date = Time::local( *postid.scan( /^(\d{4})(\d\d)(\d\d)(\d\d)$/ )[0] ) + 12*60*60
548
541
  tdiary[date].each_visible_trackback(100) {|com,i|
549
- url, name, title, excerpt = com.body.split( /\n/,4 )
542
+ url, _, title, _ = com.body.split( /\n/,4 )
550
543
  result << {
551
544
  'pingURL' => url,
552
545
  'pingIP' => '127.0.0.1',
data/package.json CHANGED
@@ -21,9 +21,9 @@
21
21
  },
22
22
  "homepage": "https://github.com/tdiary/tdiary-core",
23
23
  "devDependencies": {
24
- "bower": "~1.2.8",
25
- "grunt": "~0.4.4",
26
- "grunt-cli": "~0.1.13",
27
- "grunt-bower-task": "~0.3.4"
24
+ "bower": "*",
25
+ "grunt": "*",
26
+ "grunt-cli": "*",
27
+ "grunt-bower-task": "*"
28
28
  }
29
29
  }
data/plugin/00default.rb CHANGED
@@ -472,7 +472,7 @@ def nyear_link( date, title )
472
472
  d = date.strftime( '%d' )
473
473
  years = @years.find_all {|year, months| months.include? m}
474
474
  if years.length >= 2 then
475
- %Q|#{title} <span class="nyear">[<a href="#{h @conf.index}#{anchor m + d}" title="#{h(nyear_diary_title(date, years))}">#{nyear_diary_label date, years}</a>]</span>|
475
+ %Q|#{title} <span class="nyear">[<a href="#{h @conf.index}#{anchor m + d}" title="#{h(nyear_diary_title)}">#{nyear_diary_label}</a>]</span>|
476
476
  else
477
477
  title
478
478
  end
data/plugin/05referer.rb CHANGED
@@ -93,7 +93,6 @@ class RefererDiary
93
93
  @current_date = d
94
94
  yield( self )
95
95
  end
96
- current_date = nil
97
96
  end
98
97
  end
99
98
 
@@ -84,18 +84,6 @@ add_conf_proc( 'spamfilter', @spamfilter_label_conf, 'security' ) do
84
84
  @conf['spamfilter.date_limit'] = nil
85
85
  end
86
86
 
87
- if @conf['spamfilter.filter_mode'].nil? || @conf['spamfilter.filter_mode']
88
- filter_mode = true
89
- else
90
- filter_mode = false
91
- end
92
-
93
- if @conf['spamfilter.resolv_check_mode'].nil? || @conf['spamfilter.resolv_check_mode']
94
- resolv_check_mode = true
95
- else
96
- resolv_check_mode = false
97
- end
98
-
99
87
  if @cgi.params['spamlookup.ip.list'] && @cgi.params['spamlookup.ip.list'][0]
100
88
  @conf['spamlookup.ip.list'] = @cgi.params['spamlookup.ip.list'][0]
101
89
  else
data/plugin/50sp.rb CHANGED
@@ -119,7 +119,7 @@ end
119
119
  # configuration menu
120
120
  # options are updated when we are eval'ed
121
121
  add_conf_proc( SP_PREFIX, @sp_label, 'basic' ) do
122
- r = @sp_label_description + sp_list_plugins( @sp_opt )
122
+ @sp_label_description + sp_list_plugins( @sp_opt )
123
123
  end
124
124
 
125
125
  # Finally, we can eval the selected plugins as tdiary.rb does
data/plugin/60sf.rb CHANGED
@@ -116,7 +116,7 @@ end
116
116
  # configuration menu
117
117
  # options are updated when we are eval'ed
118
118
  add_conf_proc( SF_PREFIX, @sf_label, 'security' ) do
119
- r = @sf_label_description + sf_list_plugins( @sf_opt )
119
+ @sf_label_description + sf_list_plugins( @sf_opt )
120
120
  end
121
121
 
122
122
  # Finally, we can eval the selected plugins as tdiary.rb does
@@ -127,7 +127,7 @@ if sf_option( 'selected' ) && !@sf_filters then
127
127
  path = "#{dir}/#{filename}"
128
128
  if File.readable?( path ) then
129
129
  begin
130
- require path
130
+ require File.expand_path( path )
131
131
  @sf_filters << TDiary::Filter::const_get("#{File::basename(filename, ".rb").capitalize}Filter")::new(@cgi, @conf)
132
132
  plugin_path = "#{dir}/plugin/#{filename}"
133
133
  load_plugin(plugin_path) if File.readable?(plugin_path)
@@ -30,7 +30,7 @@ def title_tag
30
30
  r << '(Preferences Changed)'
31
31
  when 'nyear'
32
32
  years = @diaries.keys.map {|ymd| ymd.sub(/^\d{4}/, "")}
33
- r << "(#{years[0].sub( /^(\d\d)/, '\1-')}[#{nyear_diary_label @date, years}])" if @date
33
+ r << "(#{years[0].sub( /^(\d\d)/, '\1-')}[#{nyear_diary_label}])" if @date
34
34
  end
35
35
  r << '</title>'
36
36
  end
@@ -89,8 +89,8 @@ def submit_label
89
89
  end
90
90
  def preview_label; 'Preview'; end
91
91
 
92
- def nyear_diary_label(date, years); "my old days"; end
93
- def nyear_diary_title(date, years); "same days in past"; end
92
+ def nyear_diary_label; "my old days"; end
93
+ def nyear_diary_title; "same days in past"; end
94
94
 
95
95
 
96
96
  #
@@ -300,7 +300,6 @@ add_conf_proc( 'csrf_protection', 'CSRF Protection', 'security' ) do
300
300
  errstr = '<p class="message">No key specified. Configuration not saved.</p>'
301
301
  end
302
302
  csrf_protection_method = @conf.options['csrf_protection_method'] || 1
303
- csrf_protection_key = @conf.options['csrf_protection_key'] || ''
304
303
  <<-HTML
305
304
  #{errstr}
306
305
  <p>This page configures a protection scheme to prevent "cross-site request forgery" (CSRF) attacks.</p>
@@ -13,9 +13,6 @@ def label_no_referer; "Today's Links Excluding List"; end
13
13
  def label_only_volatile; "Volatile Links List"; end
14
14
  def label_referer_table; "Today's Links Conversion Rule"; end
15
15
 
16
- def nyear_diary_label(date, years); "my old days"; end
17
- def nyear_diary_title(date, years); "same days in past"; end
18
-
19
16
  add_conf_proc( 'referer', "Today's Link", 'referer' ) do
20
17
  saveconf_referer
21
18
 
@@ -29,8 +29,7 @@ def title_tag
29
29
  when 'saveconf'
30
30
  r << '(設定完了)'
31
31
  when 'nyear'
32
- years = @diaries.keys.map {|ymd| ymd.sub(/^\d{4}/, "")}
33
- r << "(#{h @cgi.params['date'][0].sub( /^(\d\d)/, '\1-')}[#{nyear_diary_label @date, years}])" if @date
32
+ r << "(#{h @cgi.params['date'][0].sub( /^(\d\d)/, '\1-')}[#{nyear_diary_label}])" if @date
34
33
  end
35
34
  r << '</title>'
36
35
  end
@@ -124,8 +123,8 @@ def submit_label
124
123
  end
125
124
  def preview_label; 'プレビュー'; end
126
125
 
127
- def nyear_diary_label(date, years); "長年日記"; end
128
- def nyear_diary_title(date, years); "長年日記"; end
126
+ def nyear_diary_label; "長年日記"; end
127
+ def nyear_diary_title; "長年日記"; end
129
128
 
130
129
  #
131
130
  # labels (for mobile)
@@ -300,7 +299,6 @@ add_conf_proc( 'csrf_protection', 'CSRF(乗っ取り)対策', 'security' ) do
300
299
  errstr = '<p class="message">鍵が空です。変更されませんでした。</p>'
301
300
  end
302
301
  csrf_protection_method = @conf.options['csrf_protection_method'] || 1
303
- csrf_protection_key = @conf.options['csrf_protection_key'] || ''
304
302
  <<-HTML
305
303
  #{errstr}
306
304
  <p>クロスサイト・リクエストフォージェリ(CSRF)の対策手法を設定します。</p>
@@ -19,6 +19,6 @@ describe "bq plugin w/" do
19
19
  end
20
20
 
21
21
  def expected_html_body(options)
22
- expected = %|<blockquote>\n<p>#{options[:src]}</p>\n</blockquote>\n|
22
+ %|<blockquote>\n<p>#{options[:src]}</p>\n</blockquote>\n|
23
23
  end
24
24
  end
data/tdiary/base.rb CHANGED
@@ -125,7 +125,7 @@ module TDiary
125
125
 
126
126
  begin
127
127
  r = ERB.new(rhtml.untaint).result(binding)
128
- rescue ::Encoding::CompatibilityError => e
128
+ rescue ::Encoding::CompatibilityError
129
129
  # migration error on ruby 1.9 only 1st time, reload.
130
130
  raise ForceRedirect.new(base_url)
131
131
  end
data/tdiary/compatible.rb CHANGED
@@ -33,7 +33,7 @@ class PStore
33
33
  def transaction(*args, &block)
34
34
  begin
35
35
  compatible_transaction_original(*args, &block)
36
- rescue PStoreRuby18Exception => e
36
+ rescue PStoreRuby18Exception
37
37
  # first loaded the pstore file (it's created by Ruby-1.8)
38
38
  # force convert ASCII_8BIT pstore data to UTF_8
39
39
  file = open_and_lock_file(@filename, false)
data/tdiary/core_ext.rb CHANGED
@@ -106,7 +106,7 @@ module Safe
106
106
  Proc.new {
107
107
  begin
108
108
  $SAFE = level
109
- rescue ArgumentError => e
109
+ rescue ArgumentError
110
110
  # $SAFE=4 was removed from Ruby 2.1.0.
111
111
  ensure
112
112
  result = yield
data/tdiary/plugin.rb CHANGED
@@ -272,7 +272,7 @@ module TDiary
272
272
 
273
273
  def conf_proc( key )
274
274
  r = ''
275
- label, block = @conf_procs[key]
275
+ _, block = @conf_procs[key]
276
276
  r = block.call if block
277
277
  r
278
278
  end
@@ -24,7 +24,7 @@ module TDiary
24
24
  end
25
25
  begin
26
26
  uref = CGI::unescape( ref )
27
- rescue ::Encoding::CompatibilityError => e
27
+ rescue ::Encoding::CompatibilityError
28
28
  return
29
29
  end
30
30
  if pair = @referers[uref] then
@@ -79,7 +79,6 @@ module TDiary
79
79
 
80
80
  def body_to_html
81
81
  html = ""
82
- tag = false
83
82
  @body.lines.each do |p|
84
83
  if p[0] == ?< then
85
84
  html = @body.dup
data/tdiary/style/wiki.rb CHANGED
@@ -11,6 +11,7 @@
11
11
  # You can distribute this under GPL.
12
12
  #
13
13
  require 'hikidoc'
14
+ require 'uri'
14
15
 
15
16
  module TDiary
16
17
  module Style
@@ -102,7 +103,7 @@ module TDiary
102
103
  if /^(\d{4}|\d{6}|\d{8}|\d{8}-\d+)[^\d]*?#?([pct]\d+)?$/ =~ u then
103
104
  %Q[<%=my '#{$1}#{$2}', '#{escape_quote k}' %>]
104
105
  elsif /:/ =~ u
105
- scheme, path = u.split( /:/, 2 )
106
+ scheme = URI( u ).scheme rescue nil # URI::InvalidURIError
106
107
  if /\A(?:http|https|ftp|mailto)\z/ =~ scheme
107
108
  u.sub!( /^\w+:/, '' ) if %r|://| !~ u and /^mailto:/ !~ u
108
109
  %Q[<a href="#{u}">#{k}</a>]
data/tdiary/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module TDiary
2
- VERSION = '4.0.4'
2
+ VERSION = '4.0.5'
3
3
  end
data/test/weather_test.rb CHANGED
@@ -150,6 +150,12 @@ class TestWeatherTranslaterJa < Test::Unit::TestCase
150
150
  @plugin_class = TDiary::StubPlugin::new_plugin('misc/plugin/weather.rb', 'ja')
151
151
  end
152
152
 
153
+ def test_translate_few_clouds
154
+ ja = @plugin_class::WeatherTranslator::S.new('Few clouds').\
155
+ translate(@plugin_class::Weather::Words_ja)
156
+ assert_equal('晴', ja)
157
+ end
158
+
153
159
  def test_translate_broken_clouds
154
160
  ja = @plugin_class::WeatherTranslator::S.new('broken clouds').\
155
161
  translate(@plugin_class::Weather::Words_ja)
@@ -167,6 +173,30 @@ class TestWeatherTranslaterJa < Test::Unit::TestCase
167
173
  translate(@plugin_class::Weather::Words_ja)
168
174
  assert_equal('曇', ja)
169
175
  end
176
+
177
+ def test_translate_scattered_clouds
178
+ ja = @plugin_class::WeatherTranslator::S.new('Scattered clouds').\
179
+ translate(@plugin_class::Weather::Words_ja)
180
+ assert_equal('ちぎれ雲', ja)
181
+ end
182
+
183
+ def test_translate_no_significant_weather
184
+ ja = @plugin_class::WeatherTranslator::S.new('Unknown').\
185
+ translate(@plugin_class::Weather::Words_ja)
186
+ assert_equal('', ja)
187
+ end
188
+ end
189
+
190
+ class TestWeatherTranslaterEn < Test::Unit::TestCase
191
+ def setup
192
+ @plugin_class = TDiary::StubPlugin::new_plugin('misc/plugin/weather.rb', 'en')
193
+ end
194
+
195
+ def test_translate_no_significant_weather
196
+ en = @plugin_class::WeatherTranslator::S.new('Unknown').\
197
+ translate(@plugin_class::Weather::Words_en)
198
+ assert_equal('', en)
199
+ end
170
200
  end
171
201
 
172
202
  # Stub for @conf
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdiary
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.4
4
+ version: 4.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - TADA Tadashi
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-05-29 00:00:00.000000000 Z
13
+ date: 2014-08-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor