tdiary-contrib 4.0.2.1 → 4.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,9 +15,9 @@ describe "title_anchor plugin" do
15
15
  @plugin = setup_title_anchor_plugin('day')
16
16
  end
17
17
 
18
- it { @plugin.title_anchor.should == expected_html_title_in_day(
18
+ it { expect(@plugin.title_anchor).to eq(expected_html_title_in_day(
19
19
  :index => '',
20
- :html_title => 'HsbtDiary')}
20
+ :html_title => 'HsbtDiary'))}
21
21
  end
22
22
 
23
23
  describe "in latest mode" do
@@ -25,8 +25,8 @@ describe "title_anchor plugin" do
25
25
  @plugin = setup_title_anchor_plugin('latest')
26
26
  end
27
27
 
28
- it { @plugin.title_anchor.should == expected_html_title_in_latest(
29
- :html_title => 'HsbtDiary')}
28
+ it { expect(@plugin.title_anchor).to eq(expected_html_title_in_latest(
29
+ :html_title => 'HsbtDiary'))}
30
30
  end
31
31
 
32
32
  def expected_html_title_in_day(options)
@@ -18,12 +18,12 @@ describe "twitter_js plugin" do
18
18
 
19
19
  it "for header" do
20
20
  snippet = @plugin.header_proc
21
- snippet.should == expected_html_header_snippet("123456789")
21
+ expect(snippet).to eq(expected_html_header_snippet("123456789"))
22
22
  end
23
23
 
24
24
  it "for body leave" do
25
25
  snippet = @plugin.body_leave_proc(Time.parse("20080124"))
26
- snippet.should == expected_html_body_snippet
26
+ expect(snippet).to eq(expected_html_body_snippet)
27
27
  end
28
28
  end
29
29
 
@@ -34,12 +34,12 @@ describe "twitter_js plugin" do
34
34
 
35
35
  it "for header" do
36
36
  snippet = @plugin.header_proc
37
- snippet.should == expected_html_header_snippet("123456789")
37
+ expect(snippet).to eq(expected_html_header_snippet("123456789"))
38
38
  end
39
39
 
40
40
  it "for body leave" do
41
41
  snippet = @plugin.body_leave_proc(Time.parse("20080124"))
42
- snippet.should == expected_html_body_snippet
42
+ expect(snippet).to eq(expected_html_body_snippet)
43
43
  end
44
44
  end
45
45
 
@@ -50,12 +50,12 @@ describe "twitter_js plugin" do
50
50
 
51
51
  it "for header" do
52
52
  snippet = @plugin.header_proc
53
- snippet.should be_empty
53
+ expect(snippet).to be_empty
54
54
  end
55
55
 
56
56
  it "for body leave" do
57
57
  snippet = @plugin.body_leave_proc(Time.parse("20080124"))
58
- snippet.should be_empty
58
+ expect(snippet).to be_empty
59
59
  end
60
60
  end
61
61
 
@@ -66,12 +66,12 @@ describe "twitter_js plugin" do
66
66
 
67
67
  it "for header" do
68
68
  snippet = @plugin.header_proc
69
- snippet.should be_empty
69
+ expect(snippet).to be_empty
70
70
  end
71
71
 
72
72
  it "for body leave" do
73
73
  snippet = @plugin.body_leave_proc(Time.parse("20080124"))
74
- snippet.should be_empty
74
+ expect(snippet).to be_empty
75
75
  end
76
76
  end
77
77
 
data/spec/youtube_spec.rb CHANGED
@@ -14,7 +14,7 @@ describe "youtube plugin" do
14
14
  cgi = CGIFake.new
15
15
  cgi.user_agent = k
16
16
  plugin.conf.cgi = cgi
17
- plugin.youtube(DUMMY_YOUTUBE_VIDEO_ID).should == v
17
+ expect(plugin.youtube(DUMMY_YOUTUBE_VIDEO_ID)).to eq(v)
18
18
  end
19
19
  end
20
20
  end
@@ -2,7 +2,6 @@
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'tdiary/contrib/version'
5
- require 'tdiary/version'
6
5
 
7
6
  Gem::Specification.new do |spec|
8
7
  spec.name = "tdiary-contrib"
@@ -19,7 +18,7 @@ Gem::Specification.new do |spec|
19
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
19
  spec.require_paths = ["lib"]
21
20
 
22
- spec.add_dependency 'tdiary', ">= #{TDiary::VERSION}"
21
+ spec.add_dependency 'tdiary'
23
22
 
24
23
  spec.add_development_dependency "bundler", "~> 1.3"
25
24
  spec.add_development_dependency "rake"
@@ -1,4 +1,4 @@
1
- # recent_image.rb $Revision: 2.0.3 $
1
+ # recent_image.rb $Revision: 2.0.4 $
2
2
  #
3
3
  # Copyright (c) 2005-2013 N.KASHIJUKU <n-kashi[at]whi.m-net.ne.jp>
4
4
  # You can redistribute it and/or modify it under GPL2.
@@ -184,7 +184,7 @@ def make_image_hash_rcimg
184
184
  @years.keys.sort.reverse_each do |year|
185
185
  @years[year].sort.reverse_each do |month|
186
186
  cgi.params['date'] = ["#{year}#{month}"]
187
- m = TDiaryMonth::new(cgi, '', @conf)
187
+ m = TDiaryMonthWithoutFilter::new(cgi, '', @conf)
188
188
  m.diaries.keys.sort.reverse_each do |date|
189
189
  next unless m.diaries[date].visible?
190
190
  m.diaries[date].each_section do |section|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdiary-contrib
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.2.1
4
+ version: 4.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - tDiary contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-11 00:00:00.000000000 Z
11
+ date: 2014-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tdiary
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.2
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.2
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -154,6 +154,7 @@ files:
154
154
  - lib/bayes.rb
155
155
  - lib/bayes/convert.rb
156
156
  - lib/exifparser/README
157
+ - lib/extensions/contrib.rb
157
158
  - lib/tdiary-contrib.rb
158
159
  - lib/tdiary/contrib/version.rb
159
160
  - lib/wgs2tky.rb
@@ -187,6 +188,7 @@ files:
187
188
  - plugin/category_to_tagcloud.rb
188
189
  - plugin/cocomment.rb
189
190
  - plugin/code-prettify.rb
191
+ - plugin/coderay.rb
190
192
  - plugin/coderwall.rb
191
193
  - plugin/datepicker.rb
192
194
  - plugin/day2section.rb
@@ -260,6 +262,7 @@ files:
260
262
  - plugin/my_hotentry.rb
261
263
  - plugin/navi_day.rb
262
264
  - plugin/navi_this_month.rb
265
+ - plugin/nhk_program_info.rb
263
266
  - plugin/nicovideo.rb
264
267
  - plugin/notify_miniblog.rb
265
268
  - plugin/ogp.rb
@@ -281,7 +284,6 @@ files:
281
284
  - plugin/retweet.rb
282
285
  - plugin/rubykaigi.rb
283
286
  - plugin/search-bing.rb
284
- - plugin/search-default.rb
285
287
  - plugin/search-google-custom.rb
286
288
  - plugin/search-yahoo-websearch.rb
287
289
  - plugin/search-yahoo.rb
@@ -431,9 +433,6 @@ files:
431
433
  - util/tdiary-vim/ChangeLog
432
434
  - util/tdiary-vim/README
433
435
  - util/tdiary-vim/tdiary.vim
434
- - util/tdiarysearch/README.en
435
- - util/tdiarysearch/README.ja
436
- - util/tdiarysearch/search.rb
437
436
  homepage: http://www.tdiary.org/
438
437
  licenses:
439
438
  - GPL-2 and/or others
@@ -454,7 +453,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
454
453
  version: '0'
455
454
  requirements: []
456
455
  rubyforge_project:
457
- rubygems_version: 2.1.11
456
+ rubygems_version: 2.2.2
458
457
  signing_key:
459
458
  specification_version: 4
460
459
  summary: tDiary contributions package
@@ -1,269 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # search-default.rb - site search plugin sample using DefaultIO.
4
- #
5
- # Copyright (C) 2003-2005 Minero Aoki
6
- # Copyright (C) 2012, TADA Tadashi <t@tdtds.jp>
7
- # You can redistribute it and/or modify it under GPL2.
8
- #
9
- #
10
-
11
- def search_title
12
- '全文検索'
13
- end
14
-
15
- class WrongQuery < StandardError; end
16
-
17
- module DefaultIOSearch
18
-
19
- module_function
20
- def setup_patterns(query)
21
- patterns = split_string(query).map {|pat|
22
- check_pattern pat
23
- Regexp.new( Regexp.quote(pat), Regexp::IGNORECASE )
24
- }
25
- raise WrongQuery, 'no pattern' if patterns.empty?
26
- raise WrongQuery, 'too many sub patterns' if patterns.length > 8
27
- patterns
28
- end
29
-
30
- def check_pattern(pat)
31
- raise WrongQuery, 'no pattern' unless pat
32
- raise WrongQuery, 'empty pattern' if pat.empty?
33
- raise WrongQuery, "pattern too short: #{pat}" if pat.length < 2
34
- raise WrongQuery, 'pattern too long' if pat.length > 128
35
- end
36
-
37
- def split_string(str)
38
- str.split(/[\s ]+/ou).reject {|w| w.empty? }
39
- end
40
-
41
- INF = 1 / 0.0
42
-
43
- def match_components(patterns, data_path)
44
- foreach_diary_from_latest(data_path) do |diary|
45
- next unless diary.visible?
46
- num = 1
47
- diary.each_section do |sec|
48
- if patterns.all? {|re| re =~ sec.to_src }
49
- yield diary, fragment('p', num), sec
50
- end
51
- num += 1
52
- end
53
- diary.each_visible_comment(INF) do |cmt, num|
54
- if patterns.all? {|re| re =~ cmt.body }
55
- yield diary, fragment('c', num), cmt
56
- end
57
- end
58
- end
59
- end
60
-
61
- def fragment(type, num)
62
- sprintf('%s%02d', type, num)
63
- end
64
-
65
- #
66
- # tDiary Implementation Dependent
67
- #
68
- def foreach_diary_from_latest(data_path, &block)
69
- foreach_data_file(data_path.sub(%r</+\z>, '')) do |path|
70
- read_diaries(path).sort_by {|diary| diary.date }.reverse_each(&block)
71
- end
72
- end
73
-
74
- def foreach_data_file(data_path, &block)
75
- Dir.glob("#{data_path}/[0-9]*/*.td2").sort.reverse_each do |path|
76
- yield path.untaint
77
- end
78
- end
79
-
80
- def read_diaries(path)
81
- d = nil
82
- diaries = {}
83
- load_tdiary_textdb(path) do |header, body|
84
- begin
85
- d = diary_class(header['Format']).new(header['Date'], '', body)
86
- rescue ArgumentError
87
- next
88
- end
89
- d.show(header['Visible'] != 'false')
90
- diaries[d.ymd] = d
91
- end
92
- (Years[d.y] ||= []).push(d.m) if d
93
- load_comments diaries, path
94
- diaries.values
95
- end
96
-
97
- DIARY_CLASS_CACHE = {}
98
-
99
- def diary_class(style)
100
- c = DIARY_CLASS_CACHE[style]
101
- return c if c
102
- if TDiary.const_defined?('Style')
103
- require "tdiary/style/#{style.downcase}.rb"
104
- c = eval("TDiary::Style::#{style.capitalize}Diary")
105
- else
106
- require "tdiary/style/#{style.downcase}_style.rb"
107
- c = eval("TDiary::#{style.capitalize}Diary")
108
- end
109
- c.__send__(:include, DiaryClassDelta)
110
- DIARY_CLASS_CACHE[style] = c
111
- c
112
- end
113
-
114
- module DiaryClassDelta
115
- def ymd
116
- date().strftime('%Y%m%d')
117
- end
118
-
119
- def y_m_d
120
- date().strftime('%Y-%m-%d')
121
- end
122
-
123
- def y
124
- '%04d' % date().year
125
- end
126
-
127
- def m
128
- '%02d' % date().month
129
- end
130
- end
131
-
132
- def load_comments(diaries, path)
133
- cmtfile = path.sub(/2\z/, 'c')
134
- return unless File.file?(cmtfile)
135
- load_tdiary_textdb(cmtfile) do |header, body|
136
- c = TDiary::Comment.new(header['Name'], header['Mail'], body,
137
- Time.at(header['Last-Modified'].to_i))
138
- c.show = (header['Visible'] != 'false')
139
- d = diaries[header['Date']]
140
- d.add_comment c if d
141
- end
142
- end
143
-
144
- def load_tdiary_textdb(path)
145
- File.open(path) {|f|
146
- ver = f.gets.strip
147
- raise "unkwnown format: #{ver}" unless ver == 'TDIARY2.00.00' or ver == 'TDIARY2.01.00'
148
- f.each('') do |header|
149
- h = {}
150
- header.untaint.strip.each_line do |line|
151
- begin
152
- n, v = *line.split(':', 2)
153
- rescue ArgumentError
154
- next
155
- end
156
- h[n.strip] = v.strip
157
- end
158
- body = f.gets("\n.\n").chomp(".\n").untaint
159
- yield h, body
160
- end
161
- }
162
- end
163
-
164
- def short_html(component)
165
- # Section classes do not have common superclass, we can't use class here.
166
- case component.class.name
167
- when /Section/
168
- section = component
169
- if section.subtitle
170
- sprintf('%s<br>%s',
171
- tdiary2text(section.subtitle_to_html),
172
- tdiary2text(section.body_to_html))
173
- else
174
- tdiary2text(section.body_to_html)
175
- end
176
- when /Comment/
177
- cmt = component
178
- shorten(escape((cmt.name + ': ' + cmt.body)))
179
- else
180
- raise "must not happen: #{component.class}"
181
- end
182
- end
183
-
184
- def tdiary2text(html)
185
- re = Regexp.new('<[^>]*>', Regexp::EXTENDED)
186
- shorten(apply_tdiary_plugins(html).gsub(re, ''))
187
- end
188
-
189
- Years = {}
190
-
191
- TDiary::Plugin.__send__(:public, :apply_plugin)
192
- def apply_tdiary_plugins(html)
193
- #@plugin.apply_plugin(html, false)
194
- html
195
- end
196
-
197
- @plugin = nil
198
-
199
- #
200
- # Utils
201
- #
202
- HTML_ESCAPE_TABLE = {
203
- '&' => '&amp;',
204
- '<' => '&lt;',
205
- '>' => '&gt;',
206
- '"' => '&quot;'
207
- }
208
-
209
- def escape(str)
210
- tbl = HTML_ESCAPE_TABLE
211
- str.gsub(/[&"<>]/) {|ch| tbl[ch] }
212
- end
213
-
214
- def shorten(str, len = 200)
215
- matched = str.gsub( /\n/, ' ' ).scan( /^.{0,#{len - 3}}/u )[0]
216
- if $'.nil? || $'.empty?
217
- matched
218
- else
219
- matched + '...'
220
- end
221
- end
222
- end
223
-
224
- def search_input_form( q )
225
- r = <<-HTML
226
- <form method="GET" action="#{@conf.index}"><div>
227
- 検索キーワード:
228
- <input name="q" value="#{h q}">
229
- <input type="submit" value="OK">
230
- </div></form>
231
- HTML
232
- end
233
-
234
- def search_result
235
- unless @conf.io_class == (TDiary.const_defined?('DefaultIO') ? TDiary::DefaultIO : TDiary::IO::Default)
236
- return %Q|<p class="message">could not use this plugin under #{@conf.io_class}.</p>|
237
- end
238
-
239
- query = CGI::unescape( @cgi.params['q'][0] )
240
- start = CGI::unescape( @cgi.params['start'][0] || '0' ).to_i
241
-
242
- begin
243
- patterns = DefaultIOSearch::setup_patterns(query)
244
- r = search_input_form( query )
245
-
246
- r << '<dl class="search-result autopagerize_page_element">'
247
- count = 0
248
- too_many = false
249
- DefaultIOSearch::match_components(patterns, @conf.data_path) do |diary, fragment, component|
250
- count += 1
251
- if count > 50 # TO MANY HITS
252
- too_many = true
253
- break
254
- end
255
- href = @conf.index + anchor( "#{diary.ymd}#{fragment}" )
256
- r << %Q|<dt><a href="#{href}">#{h diary.y_m_d}</a></dt>|
257
- r << %Q|<dd>#{DefaultIOSearch::short_html(component)}</dd>|
258
- end
259
- r << '</dl>'
260
-
261
- r << '<div class="search-navi">'
262
- r << "<p>#{too_many ? 'too many' : count} hits.</p>"
263
- r << '</div>'
264
-
265
- r
266
- rescue WrongQuery
267
- search_input_form( query ) + %Q|<p class="message">#{$!.message}</p>|
268
- end
269
- end