tdiary-contrib 5.0.2 → 5.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tdiary/contrib/version.rb +1 -1
- data/plugin/flickr.rb +1 -1
- data/plugin/ogp.rb +28 -13
- data/plugin/playstore.rb +1 -1
- data/spec/flicker_spec.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b861b8e242e49d48b1bf2a4d221e45358aeac56
|
4
|
+
data.tar.gz: da7a57a662ae3892930d9b6854ed82070a0cc277
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1a4b72e93928bac1131636987550e6f2ca4fa4a9bc5ce13fa8ef822ecbf4b04e9493f0d51595e542adf165f34976634bfb9d0827b819ed8ae5b0f78918f616a
|
7
|
+
data.tar.gz: ad99181c743a43a23eb42be2627130cc608d3634cce262509856858bc0b148c1146d7098abb9f9f8653691198edaa71fdbeac7874e07764fc38361710202d6b2
|
data/plugin/flickr.rb
CHANGED
@@ -43,7 +43,7 @@ def flickr(photo_id, size = nil, place = 'flickr')
|
|
43
43
|
return '[ERROR] flickr.rb: failed to get photo.'
|
44
44
|
end
|
45
45
|
|
46
|
-
%Q|<a href="#{photo[:page]}" class="flickr"><img title="#{photo[:title]}" alt="#{photo[:title]}" src="#{photo[:src]}" class="#{place} photo"></a>|
|
46
|
+
%Q|<a href="#{photo[:page]}" class="flickr"><img title="#{photo[:title]}" alt="#{photo[:title]}" src="#{photo[:src]}" class="#{place} photo" height="#{photo[:height]}" width="#{photo[:width]}"></a>|
|
47
47
|
end
|
48
48
|
|
49
49
|
def flickr_left(photo_id, size = nil)
|
data/plugin/ogp.rb
CHANGED
@@ -7,31 +7,46 @@
|
|
7
7
|
# @conf['ogp.facebook.app_id'] - your facebook application ID.
|
8
8
|
# @conf['ogp.facebook.admins'] - your facebook ID.
|
9
9
|
|
10
|
-
def ogp_description
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
10
|
+
def ogp_description(html)
|
11
|
+
@conf.shorten(remove_tag(html), 200)
|
12
|
+
end
|
13
|
+
|
14
|
+
def ogp_image(html)
|
15
|
+
images = html.scan(/<img.*?src="(.*?)"/)
|
16
|
+
if !images.empty?
|
17
|
+
images.first[0]
|
18
18
|
else
|
19
|
-
@conf.
|
19
|
+
@conf.banner
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
add_header_proc do
|
24
24
|
headers = {
|
25
|
-
# TODO: og:urlへ対応
|
26
25
|
'og:title' => title_tag.match(/>([^<]+)</).to_a[1],
|
27
26
|
'og:site_name' => @conf.html_title,
|
28
|
-
'og:description' => ogp_description,
|
29
|
-
'og:image' => @conf.banner,
|
30
|
-
'og:type' => (@mode == 'day') ? 'article' : 'blog',
|
31
27
|
'og:author' => @conf.author_name,
|
32
28
|
'fb:app_id' => @conf['ogp.facebook.app_id'],
|
33
29
|
'fb:admins' => @conf['ogp.facebook.admins']
|
34
30
|
}
|
31
|
+
|
32
|
+
if @mode == 'day'
|
33
|
+
diary = @diaries[@date.strftime('%Y%m%d')]
|
34
|
+
if diary
|
35
|
+
sections = diary.instance_variable_get(:@sections)
|
36
|
+
section_index = @cgi.params['p'][0] || sections.size
|
37
|
+
section = sections[section_index.to_i - 1].body_to_html
|
38
|
+
section_html = apply_plugin(section)
|
39
|
+
|
40
|
+
headers['og:description'] = ogp_description(section_html)
|
41
|
+
headers['og:image'] = ogp_image(section_html)
|
42
|
+
headers['og:type'] = 'article'
|
43
|
+
end
|
44
|
+
else
|
45
|
+
headers['og:description'] = @conf.description
|
46
|
+
headers['og:image'] = @conf.banner
|
47
|
+
headers['og:type'] = 'website'
|
48
|
+
end
|
49
|
+
|
35
50
|
headers.select {|key, val|
|
36
51
|
val && !val.empty?
|
37
52
|
}.map {|key, val|
|
data/plugin/playstore.rb
CHANGED
data/spec/flicker_spec.rb
CHANGED
@@ -15,7 +15,7 @@ describe "flickr plugin" do
|
|
15
15
|
subject { plugin.flickr('5950109223', size = nil) }
|
16
16
|
|
17
17
|
it do
|
18
|
-
expect(subject).to eq %Q|<a href=\"https://www.flickr.com/photos/machu/5950109223/\" class=\"flickr\"><img title=\"RubyKaigi 2011\" alt=\"RubyKaigi 2011\" src=\"https://farm7.staticflickr.com/6006/5950109223_040097db92.jpg\" class=\"flickr photo\"></a>|
|
18
|
+
expect(subject).to eq %Q|<a href=\"https://www.flickr.com/photos/machu/5950109223/\" class=\"flickr\"><img title=\"RubyKaigi 2011\" alt=\"RubyKaigi 2011\" src=\"https://farm7.staticflickr.com/6006/5950109223_040097db92.jpg\" class=\"flickr photo\" height=\"375\" width=\"500\"></a>|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
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: 5.0.
|
4
|
+
version: 5.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: 2016-
|
11
|
+
date: 2016-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tdiary
|
@@ -503,7 +503,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
503
503
|
version: '0'
|
504
504
|
requirements: []
|
505
505
|
rubyforge_project:
|
506
|
-
rubygems_version: 2.5.
|
506
|
+
rubygems_version: 2.5.2
|
507
507
|
signing_key:
|
508
508
|
specification_version: 4
|
509
509
|
summary: tDiary contributions package
|