tdiary-blogkit 5.0.5 → 5.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +23 -0
- data/lib/tdiary-blogkit.rb +1 -0
- data/lib/tdiary/blogkit/version.rb +1 -1
- data/lib/tdiary/style/bloggfm.rb +64 -0
- data/plugin/recent-entry.rb +12 -59
- data/plugin/whatsnew-list.rb +31 -19
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2389fc4713f1f34ae0b60d624634428024977bf
|
4
|
+
data.tar.gz: ff5dfee302f6d94084f03985d649b41b9769c456
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da00021a8a7eba7bb45a5bddb8e3256f7256fe96c5e7f6f1bc6773c47c712c8c5fd1427d6f8f55c8de0d43fa8ea2365373dc16809f5a34fbd5996c17a6d9fe23
|
7
|
+
data.tar.gz: c41424b4eb2a9cafd4afb158a983d1c3668bb612a8b5c33a5c0f163db26386acfc4d0031eed8da7c3612cb4f1b67134401d001bce68e0388853e6f28271bf001
|
data/ChangeLog
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
2017-09-29 TADA Tadashi <t@tdtds.jp>
|
2
|
+
* release 5.0.6
|
3
|
+
|
4
|
+
2017-09-08 TADA Tadashi <t@tdtds.jp>
|
5
|
+
* remove secure mode support and merge to single method
|
6
|
+
* recent_list.rb: update like recent_list plugin in core package
|
7
|
+
* recent_list.rb: update to modern style and fix some information
|
8
|
+
|
9
|
+
2017-07-14 Tatsuya Sato <satoryu.1981@gmail.com>
|
10
|
+
* Add bloggfm style
|
11
|
+
|
12
|
+
2017-07-13 TADA Tadashi <t@tdtds.jp>
|
13
|
+
* fix error of whatsnew_list plugin on startup
|
14
|
+
|
15
|
+
2017-06-29 TADA Tadashi <t@tdtds.jp>
|
16
|
+
* release 5.0.5
|
17
|
+
|
18
|
+
2017-03-29 TADA Tadashi <t@tdtds.jp>
|
19
|
+
* release 5.0.4
|
20
|
+
|
21
|
+
2016-12-29 TADA Tadashi <t@tdtds.jp>
|
22
|
+
* release 5.0.3
|
23
|
+
|
1
24
|
2016-09-29 TADA Tadashi <t@tdtds.jp>
|
2
25
|
* release 5.0.2
|
3
26
|
|
data/lib/tdiary-blogkit.rb
CHANGED
@@ -0,0 +1,64 @@
|
|
1
|
+
# vi: set noexpandtab tabstop=3
|
2
|
+
require 'tdiary/style/gfm'
|
3
|
+
|
4
|
+
module TDiary
|
5
|
+
module Style
|
6
|
+
class BloggfmSection < GfmSection
|
7
|
+
end
|
8
|
+
|
9
|
+
class BloggfmDiary < GfmDiary
|
10
|
+
def style
|
11
|
+
'BlogGfm'
|
12
|
+
end
|
13
|
+
|
14
|
+
def append( body, author = nil )
|
15
|
+
in_code_block = false
|
16
|
+
section = nil
|
17
|
+
body.each_line do |l|
|
18
|
+
case l
|
19
|
+
when /^\#[^\#]/
|
20
|
+
if in_code_block
|
21
|
+
section << l
|
22
|
+
else
|
23
|
+
@sections << BloggfmSection.new(section, author) if section
|
24
|
+
section = l
|
25
|
+
end
|
26
|
+
when /^```/
|
27
|
+
in_code_block = !in_code_block
|
28
|
+
section << l
|
29
|
+
else
|
30
|
+
section = '' unless section
|
31
|
+
section << l
|
32
|
+
end
|
33
|
+
end
|
34
|
+
if section
|
35
|
+
section << "\n" unless section =~ /\n\n\z/
|
36
|
+
@sections << BloggfmSection.new(section, author)
|
37
|
+
end
|
38
|
+
@last_modified = Time.now
|
39
|
+
self
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_html4( opt )
|
43
|
+
r = ''
|
44
|
+
idx = 1
|
45
|
+
each_section do |section|
|
46
|
+
if idx > 1 and not opt['anchor'] then
|
47
|
+
r << %Q|<p class="readmore"><a href="#{opt['index']}<%=anchor "#{date.strftime( '%Y%m%d' )}"%>">Read more..</a></p>\n|
|
48
|
+
break
|
49
|
+
end
|
50
|
+
r << section.html4( date, idx, opt )
|
51
|
+
idx += 1
|
52
|
+
end
|
53
|
+
r
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Local Variables:
|
60
|
+
# mode: ruby
|
61
|
+
# indent-tabs-mode: t
|
62
|
+
# tab-width: 3
|
63
|
+
# ruby-indent-level: 3
|
64
|
+
# End:
|
data/plugin/recent-entry.rb
CHANGED
@@ -1,88 +1,41 @@
|
|
1
|
-
# recent_entry.rb $Revision: 1.13 $
|
2
|
-
#
|
3
1
|
# recent_entry: modified 'title_list' for Blogkit.
|
4
2
|
# parameter(default):
|
5
3
|
# max: maximum list items (5)
|
6
4
|
# limit: max lengh of each items (20)
|
7
5
|
#
|
8
|
-
# Copyright (c) 2002 TADA Tadashi <
|
6
|
+
# Copyright (c) 2002 TADA Tadashi <t@tdtds.jp>
|
9
7
|
# Copyright (c) 2001,2002 Junichiro KITA <kita@kitaj.no-ip.com>
|
10
|
-
# You can redistribute it and/or modify it under
|
8
|
+
# You can redistribute it and/or modify it under GPL.
|
11
9
|
#
|
12
10
|
|
13
|
-
def recent_entry(
|
14
|
-
result = "<ul>\n"
|
15
|
-
if @conf.secure then
|
16
|
-
result << recent_entry_secure( max, limit )
|
17
|
-
else
|
18
|
-
result << recent_entry_insecure( max, limit )
|
19
|
-
end
|
20
|
-
result << "</ul>\n"
|
21
|
-
apply_plugin( result )
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
#---- private ----#
|
26
|
-
def recent_entry_secure( max = 5, limit = 20 )
|
27
|
-
max = max.to_i
|
28
|
-
limit = limit.to_i
|
29
|
-
|
30
|
-
result = ''
|
31
|
-
@diaries.keys.sort.reverse.each_with_index do |date, idx|
|
32
|
-
break if idx >= max
|
33
|
-
diary = @diaries[date]
|
34
|
-
next unless diary.visible?
|
35
|
-
title = if diary.respond_to?( :stripped_title ) then
|
36
|
-
diary.stripped_title.gsub( /<[^>]*>/, '' )
|
37
|
-
else
|
38
|
-
diary.title.gsub( /<[^>]*>/, '' )
|
39
|
-
end
|
40
|
-
title = 'no title' if title.empty?
|
41
|
-
result << %Q[<li><a href="#{h @index}#{anchor date}">#{@conf.shorten( title, limit )}</a></li>\n]
|
42
|
-
end
|
43
|
-
result
|
44
|
-
end
|
45
|
-
|
46
|
-
eval( <<MODIFY_CLASS, TOPLEVEL_BINDING )
|
47
|
-
module TDiary
|
48
|
-
class TDiaryMonth
|
49
|
-
attr_reader :diaries
|
50
|
-
end
|
51
|
-
end
|
52
|
-
MODIFY_CLASS
|
53
|
-
|
54
|
-
def recent_entry_insecure( max = 5, limit = 20 )
|
11
|
+
def recent_entry(max = 5, limit = 20)
|
55
12
|
max = max.to_i
|
56
13
|
limit = limit.to_i
|
57
14
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
result = ''
|
62
|
-
catch( :exit ) {
|
15
|
+
result = "<ul>\n"
|
16
|
+
catch(:exit) {
|
63
17
|
@years.keys.sort.reverse_each do |year|
|
64
18
|
@years[year].sort.reverse_each do |month|
|
65
|
-
|
66
|
-
m = TDiaryMonth::new( cgi, '', @conf )
|
19
|
+
m = DiaryContainer::find_by_month(@conf, "#{year}#{month}")
|
67
20
|
m.diaries.keys.sort.reverse_each do |date|
|
68
21
|
next unless m.diaries[date].visible?
|
69
|
-
title = if m.diaries[date].respond_to?(
|
70
|
-
title = m.diaries[date].stripped_title.gsub(
|
22
|
+
title = if m.diaries[date].respond_to?(:stripped_title) then
|
23
|
+
title = m.diaries[date].stripped_title.gsub(/<[^>]*>/, '')
|
71
24
|
else
|
72
|
-
title = m.diaries[date].title.gsub(
|
25
|
+
title = m.diaries[date].title.gsub(/<[^>]*>/, '')
|
73
26
|
end
|
74
27
|
title = 'no title' if title.empty?
|
75
|
-
result << %Q|<li><a href="#{h @index}#{anchor date}">#{@conf.shorten(
|
28
|
+
result << %Q|<li><a href="#{h @index}#{anchor date}">#{@conf.shorten(title, limit)}</a></li>\n|
|
76
29
|
max -= 1
|
77
30
|
throw :exit if max == 0
|
78
31
|
end
|
79
32
|
end
|
80
33
|
end
|
81
34
|
}
|
82
|
-
result
|
35
|
+
result << "</ul>\n"
|
36
|
+
apply_plugin(result)
|
83
37
|
end
|
84
38
|
|
85
|
-
|
86
39
|
# Local Variables:
|
87
40
|
# mode: ruby
|
88
41
|
# indent-tabs-mode: t
|
data/plugin/whatsnew-list.rb
CHANGED
@@ -96,7 +96,12 @@ end
|
|
96
96
|
# private methods
|
97
97
|
#
|
98
98
|
def whatsnew_list_rdf_file
|
99
|
-
@conf['whatsnew_list.rdf']
|
99
|
+
return @conf['whatsnew_list.rdf'] if @conf['whatsnew_list.rdf']
|
100
|
+
if @cgi.is_a?(RackCGI)
|
101
|
+
File.join(TDiary.server_root, 'public/index.rdf')
|
102
|
+
else
|
103
|
+
File.join(TDiary.server_root, 'index.rdf')
|
104
|
+
end
|
100
105
|
end
|
101
106
|
|
102
107
|
def whatsnew_list_rdf( items )
|
@@ -175,6 +180,28 @@ def feed?
|
|
175
180
|
@whatsnew_list_in_feed
|
176
181
|
end
|
177
182
|
|
183
|
+
def whatsnew_list_update_feed(new_items = [])
|
184
|
+
transaction( 'whatsnew-list' ) do |db|
|
185
|
+
wn = []
|
186
|
+
(JSON.load(db.get('whatsnew')) || []).each_with_index do |item, i|
|
187
|
+
wn << item unless item[0] == new_items[0]
|
188
|
+
break if i > 15
|
189
|
+
end
|
190
|
+
|
191
|
+
unless (new_items.empty?)
|
192
|
+
wn.unshift new_items
|
193
|
+
db.set('whatsnew', wn.to_json)
|
194
|
+
end
|
195
|
+
|
196
|
+
rdf = whatsnew_list_rdf_file
|
197
|
+
if @conf['whatsnew_list.rdf.out'] then
|
198
|
+
open(rdf, 'w') do |f|
|
199
|
+
f.write(whatsnew_list_rdf(wn))
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
178
205
|
def whatsnew_list_update
|
179
206
|
return if @mode == 'comment' and !@comment.visible?
|
180
207
|
|
@@ -206,23 +233,8 @@ def whatsnew_list_update
|
|
206
233
|
|
207
234
|
@whatsnew_list_in_feed = false
|
208
235
|
|
209
|
-
|
210
|
-
|
211
|
-
wn = []
|
212
|
-
(JSON.load( db.get( 'whatsnew' ) ) || []).each_with_index do |item, i|
|
213
|
-
wn << item unless item[0] == new_item[0]
|
214
|
-
break if i > 15
|
215
|
-
end
|
216
|
-
wn.unshift new_item if diary.visible?
|
217
|
-
db.set( 'whatsnew', wn.to_json )
|
218
|
-
|
219
|
-
rdf = whatsnew_list_rdf_file
|
220
|
-
if @conf['whatsnew_list.rdf.out'] then
|
221
|
-
open( rdf, 'w' ) do |f|
|
222
|
-
f.write( whatsnew_list_rdf( wn ) )
|
223
|
-
end
|
224
|
-
end
|
225
|
-
end
|
236
|
+
new_items = [diary.date.strftime('%Y%m%d'), title, Time::now.strftime("%Y-%m-%dT%H:%M:%S#{zone}"), desc]
|
237
|
+
whatsnew_list_update_feed(diary.visible? ? new_items : [])
|
226
238
|
end
|
227
239
|
|
228
240
|
add_update_proc do
|
@@ -249,7 +261,7 @@ add_edit_proc do
|
|
249
261
|
end
|
250
262
|
|
251
263
|
add_startup_proc do
|
252
|
-
|
264
|
+
whatsnew_list_update_feed
|
253
265
|
end
|
254
266
|
|
255
267
|
# Local Variables:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tdiary-blogkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tDiary contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hikidoc
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: tdiary-style-gfm
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: bundler
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,6 +128,7 @@ files:
|
|
114
128
|
- lib/tdiary/blogkit/version.rb
|
115
129
|
- lib/tdiary/extensions/blogkit.rb
|
116
130
|
- lib/tdiary/style/blog.rb
|
131
|
+
- lib/tdiary/style/bloggfm.rb
|
117
132
|
- lib/tdiary/style/blogrd.rb
|
118
133
|
- lib/tdiary/style/blogwiki.rb
|
119
134
|
- plugin/archive.rb
|
@@ -155,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
170
|
version: '0'
|
156
171
|
requirements: []
|
157
172
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.6.
|
173
|
+
rubygems_version: 2.6.13
|
159
174
|
signing_key:
|
160
175
|
specification_version: 4
|
161
176
|
summary: tDiary blogkit package.
|