tdiary-contrib 3.2.2.20130614 → 4.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6160075d3a10a3f127fd3ec59f82b59a5ea4e494
4
- data.tar.gz: 4302b52ef1948c223e5e1ce311c13bc601856e45
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MTA2NTZkMTYzYjk5MTczYTJmMzQ4NTMzNzY5ZjZlNzdhNzhhM2Y4NQ==
5
+ data.tar.gz: !binary |-
6
+ ZjMyYzVhZjljMTgwYjcyODk2MTY3NGUyYTA4YThlMjY1OTJhNjMzMQ==
5
7
  SHA512:
6
- metadata.gz: 2c3204d15ab266d374ae86082854cd7a82f38118509b6b85e56ef69ba5aedca4fa0e66b8682e4de391b671b6cac9376c3f0e124ab8ab659417eeef78225656cd
7
- data.tar.gz: 52c0bd44604864f41e488564e38564c1e20b7126a3faf320aa224dc2f71bea2ebfab0279f426eb6c4e9f09105a467f6cb77b0445d6c9b4b6409eddc724233d70
8
+ metadata.gz: !binary |-
9
+ N2Y0ZTVmZDNhYzdmNzEzOWY0OTdkZWM1NmEyNTFjMDExMTI4ZTFiY2Y5ZTJi
10
+ MjAzNjk4NGIzYmJmYWI5Y2JiMmIxYmNjOTg4NmU0YjE5ZjAzNWM5Zjk0YWNh
11
+ OGUzZjE0MjNhNzlmODhlMmRjYTk0NDAzYjQ2ZmY0ODQxYzVjYjk=
12
+ data.tar.gz: !binary |-
13
+ NWU1MzJlODJmMDI1ZWE2MzJmNmRlZGE2ODMxY2EzM2VhOTg0OGQ2Mjk0NDhj
14
+ YjYyM2JkMGNiMGNjNDI5ZTU1NmYzNjVkMmFiM2YzNzg0MzIxNjYwODYwNGIw
15
+ MzRhNDc3MDU1YWUwMzIyYjYyM2RkZWUzMTdlZWQ2MDE3ZDY1YjE=
data/Gemfile.lock CHANGED
@@ -1,24 +1,26 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- diff-lcs (1.2.4)
5
- json (1.8.0)
6
- multi_json (1.7.3)
7
- rake (10.0.4)
4
+ diff-lcs (1.2.5)
5
+ docile (1.1.1)
6
+ json (1.8.1)
7
+ multi_json (1.8.2)
8
+ rake (10.1.0)
8
9
  rcov (1.0.0)
9
- rspec (2.13.0)
10
- rspec-core (~> 2.13.0)
11
- rspec-expectations (~> 2.13.0)
12
- rspec-mocks (~> 2.13.0)
13
- rspec-core (2.13.1)
14
- rspec-expectations (2.13.0)
10
+ rspec (2.14.1)
11
+ rspec-core (~> 2.14.0)
12
+ rspec-expectations (~> 2.14.0)
13
+ rspec-mocks (~> 2.14.0)
14
+ rspec-core (2.14.7)
15
+ rspec-expectations (2.14.4)
15
16
  diff-lcs (>= 1.1.3, < 2.0)
16
- rspec-mocks (2.13.1)
17
- simplecov (0.7.1)
18
- multi_json (~> 1.0)
19
- simplecov-html (~> 0.7.1)
20
- simplecov-html (0.7.1)
21
- tdiary (3.2.2.20130518)
17
+ rspec-mocks (2.14.4)
18
+ simplecov (0.8.2)
19
+ docile (~> 1.1.0)
20
+ multi_json
21
+ simplecov-html (~> 0.8.0)
22
+ simplecov-html (0.8.0)
23
+ tdiary (4.0.1.20131102)
22
24
  bundler (~> 1.3)
23
25
  thor (~> 0.18)
24
26
  thor (0.18.1)
data/js/socialbutton.js CHANGED
@@ -27,8 +27,13 @@ $(function() {
27
27
  // set options for jQuery.socialbutton
28
28
  var callbacks = {
29
29
  twitter: function(url, title) {
30
+ var link = url;
31
+ var pos = 0;
32
+ if ((pos = url.indexOf('#')) > 0) {
33
+ link = url.substr(0, pos)
34
+ }
30
35
  return {
31
- url: url,
36
+ url: link,
32
37
  text: title,
33
38
  button: 'horizontal',
34
39
  lang: $('html').attr('lang').substr(0,2)
@@ -0,0 +1,10 @@
1
+ # instagram.rb - embed your photo/videos in instagram to a diary
2
+ #
3
+ # Author: Tatsuya Sato
4
+ # License: GPL
5
+
6
+ def instagram(code, width=612, height=700)
7
+ <<-BODY
8
+ <iframe src="//instagram.com/p/#{code}/embed/" width="#{width}" height="#{height}" frameborder="0" scrolling="no" allowtransparency="true"></iframe>
9
+ BODY
10
+ end
data/plugin/playstore.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # playstore.rb
3
3
  #
4
4
  # 概要:
5
- # GooglePlay( play.goog.com)へのリンクを生成します。
5
+ # GooglePlay(play.google.com)へのリンクを生成します。
6
6
  #
7
7
  # 使い方:
8
8
  # playstore'app_id' or playstore_txt'app_id'
@@ -44,8 +44,13 @@ class PlayStore < MarketBot::Android::App
44
44
  end
45
45
  return html
46
46
  end
47
+
48
+ def self.valid?(app_id)
49
+ return app_id.downcase =~ /^([a-z_]{1}[a-z0-9_]*(\.[a-z_]{1}[a-z0-9_]*)*)$/
50
+ end
47
51
  end
48
52
 
53
+
49
54
  def playstore_load_cache(app)
50
55
  path="#{@cache_path}/playstore/#{app.app_id}"
51
56
  begin
@@ -66,8 +71,12 @@ def playstore_save_cache(app)
66
71
  app.save(path)
67
72
  end
68
73
 
69
- def playstore(app_id)
70
- app = PlayStore.new(app_id)
74
+ def playstore_main(app_id)
75
+ unless PlayStore.valid?(app_id)
76
+ return :invalid
77
+ end
78
+
79
+ app = PlayStore.new(app_id)
71
80
  if playstore_load_cache(app).nil?
72
81
  app.update
73
82
  save = true
@@ -75,70 +84,78 @@ def playstore(app_id)
75
84
  save = false
76
85
  end
77
86
  if app.nil? || app.error
78
- html =
79
- <<-HTML
80
- <div class="market">#{app_id} was not found.</div>
81
- HTML
87
+ return :notfound
82
88
  else
83
89
  playstore_save_cache(app) if save
84
- html =
90
+ return app
91
+ end
92
+ end
93
+
94
+ def playstore(app_id)
95
+ app = playstore_main(app_id)
96
+ case app
97
+ when :invalid
98
+ <<-HTML
99
+ <div class="playstore-frame">package name is invalid(#{app_id}).</div>
100
+ HTML
101
+ when :notfound
85
102
  <<-HTML
86
- <div class="market">
87
- <div class="leader"><a href="#{app.market_url}">#{app.title} #{app.current_version}</a>
88
- - <span class="dev">#{app.developer}</span></div>
103
+ <div class="playstore-frame">#{app_id} was not found.</div>
104
+ HTML
105
+ else
106
+ <<-HTML
107
+ <div class="playstore-frame">
108
+ <div class="playstore-leader"><a href="#{app.market_url}">#{app.title} #{app.current_version}</a>
109
+ - <span class="playstore-devlop">#{app.developer}</span></div>
89
110
  <a href="#{app.market_url}">
90
- <img class="icon" src="#{app.banner_icon_url}" title="#{app.title}">
111
+ <img class="playstore-icon" src="#{app.banner_icon_url}" title="#{app.title}" >
91
112
  </a>
92
- <ul class="info">
113
+ <ul class="playstore-detail">
93
114
  <li>Rating:#{app.rating}</li>
94
115
  <li>Price:#{app.price}</li>
95
116
  </ul>
96
117
  </div>
97
118
  HTML
98
119
  end
99
- return html
100
120
  end
101
121
 
102
122
  def playstore_text(app_id)
103
- app = PlayStore.new(app_id)
104
- if playstore_load_cache(app).nil?
105
- app.update
106
- save = true
123
+ app = playstore_main(app_id)
124
+ case app
125
+ when :invalid
126
+ "<em>package name is invalid(#{app_id}).</em>"
127
+ when :notfound
128
+ "<em>#{app_id} was not found</em>"
107
129
  else
108
- save = false
109
- end
110
- if app.nil? || app.error
111
- html = "<em>#{app_id} was not found</em>"
112
- else
113
- app.update
114
- playstore_save_cache(app) if save
115
- html=%Q[<a href="#{app.market_url}">#{app.title} #{app.current_version}</a>]
130
+ %Q[<a href="#{app.market_url}">#{app.title}</a>]
116
131
  end
117
- return html
118
132
  end
119
133
 
120
134
  add_header_proc do
121
135
  if @mode !~ /conf$/ and not bot? then
122
136
  <<-HTML
123
137
  <style type="text/css"><!--
124
- div.market ul.info {
138
+ ul.playstore-detail {
125
139
  list-style: none;
126
140
  padding: 3px;
127
141
  }
128
- div.market img.icon {
142
+ img.playstore-icon {
129
143
  float: left;
144
+ width:100px;
145
+ height:100px;
146
+ padding:6px;
130
147
  }
131
- div.market span.dev {
148
+ span.playstore-devlop {
132
149
  font-size: small;
133
150
  color: gray;
134
151
  }
135
- div.market div.leader {
152
+ div.playstore-leader {
136
153
  background: #a4c639;
137
154
  border-top-left-radius: 6px;
138
155
  border-top-right-radius: 6px;
139
156
  padding: 3px;
140
157
  }
141
- div.market {
158
+ div.playstore-frame {
142
159
  background: #f5f5f5;
143
160
  border-radius: 6px;
144
161
  margin: 5px;
@@ -100,7 +100,7 @@ module DefaultIOSearch
100
100
  c = DIARY_CLASS_CACHE[style]
101
101
  return c if c
102
102
  require "tdiary/style/#{style.downcase}_style.rb"
103
- c = eval("TDiary::#{style.capitalize}Diary")
103
+ c = TDiary.const_defined?('Style') ? eval("TDiary::Style::#{style.capitalize}Diary") : eval("TDiary::#{style.capitalize}Diary")
104
104
  c.__send__(:include, DiaryClassDelta)
105
105
  DIARY_CLASS_CACHE[style] = c
106
106
  c
@@ -24,7 +24,7 @@ require 'openssl'
24
24
  require 'json'
25
25
 
26
26
  def twitter_quote_option_keys
27
- %w( consumer_key consumer_secret token token_secret).map{|k| "twitter_quote.oauth_#{k}" }
27
+ %w( oauth_consumer_key oauth_consumer_secret oauth_token oauth_token_secret, render_method ).map{|k| "twitter_quote.#{k}" }
28
28
  end
29
29
 
30
30
  def twitter_statuses_show_api( tweet_id )
@@ -61,24 +61,17 @@ def twitter_statuses_show_api( tweet_id )
61
61
  end
62
62
  end
63
63
 
64
- def twitter_status_json_to_html( json )
65
- tweet_id = json['id_str']
66
- screen_name = json['user']['screen_name']
67
- name = json['user']['name']
68
- background_url = json['user']['profile_background_image_url']
69
- profile_background_color = "##{json['user']['profile_background_color']}"
70
- avatar = json['user']['profile_image_url']
71
- source = json['source']
72
- timestamp = Time.parse( json['created_at'] )
73
- content = json['text']
74
- content.gsub!( URI.regexp( %w|http https| ) ){ %Q|<a href="#{$&}">#{$&}</a>| }
75
- content = content.split( /(<[^>]*>)/ ).map {|s|
76
- next s if s[/\A</]
77
- s.gsub!( /@(?>([a-zA-Z0-9_]{1,15}))(?![a-zA-Z0-9_])/ ){ %Q|<a href="http://twitter.com/#{$1}">#{$&}</a>| }
78
- s.gsub( /#([a-zA-Z0-9]{1,16})/ ){ %Q|<a href="http://twitter.com/search?q=%23#{$1}">#{$&}</a>| }
79
- }.join
80
-
81
- <<-HTML
64
+ def render_widget(tweet_id, screen_name, name, background_url, profile_backgound_color, avatar, source, timestamp, content)
65
+ <<-HTML
66
+ <blockquote class="twitter-tweet"><p>#{content}</p>
67
+ &mdash; #{@name} (#{@screen_name}) <a href="http://twitter.com/#{screen_name}/status/#{tweet_id}">#{timestamp}</a>
68
+ </blockquote>
69
+ <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
70
+ HTML
71
+ end
72
+
73
+ def render_bbp(tweet_id, screen_name, name, background_url, profile_backgound_color, avatar, source, timestamp, content)
74
+ <<-HTML
82
75
  <!-- http://twitter.com/#{screen_name}/status/#{tweet_id} -->
83
76
  <div class="bbpBox" style="background:url(#{background_url}) #{profile_background_color};padding:20px;">
84
77
  <p class="bbpTweet" style=
@@ -105,6 +98,30 @@ def twitter_status_json_to_html( json )
105
98
  HTML
106
99
  end
107
100
 
101
+ def twitter_status_json_to_html( json )
102
+ tweet_id = json['id_str']
103
+ screen_name = json['user']['screen_name']
104
+ name = json['user']['name']
105
+ background_url = json['user']['profile_background_image_url']
106
+ profile_background_color = "##{json['user']['profile_background_color']}"
107
+ avatar = json['user']['profile_image_url']
108
+ source = json['source']
109
+ timestamp = Time.parse( json['created_at'] )
110
+ content = json['text']
111
+ content.gsub!( URI.regexp( %w|http https| ) ){ %Q|<a href="#{$&}">#{$&}</a>| }
112
+ content = content.split( /(<[^>]*>)/ ).map {|s|
113
+ next s if s[/\A</]
114
+ s.gsub!( /@(?>([a-zA-Z0-9_]{1,15}))(?![a-zA-Z0-9_])/ ){ %Q|<a href="http://twitter.com/#{$1}">#{$&}</a>| }
115
+ s.gsub( /#([a-zA-Z0-9]{1,16})/ ){ %Q|<a href="http://twitter.com/search?q=%23#{$1}">#{$&}</a>| }
116
+ }.join
117
+
118
+ if @conf['twitter_quote.render_method'] == 'widget'
119
+ render_widget(tweet_id, screen_name, name, background_url, profile_backgound_color, avatar, source, timestamp, content)
120
+ else
121
+ render_bbp(tweet_id, screen_name, name, background_url, profile_backgound_color, avatar, source, timestamp, content)
122
+ end
123
+ end
124
+
108
125
  def tweet_quote( src )
109
126
  return unless twitter_quote_option_keys.all?{|v| @options.key? v }
110
127
 
@@ -152,6 +169,12 @@ add_conf_proc( 'twitter_quote', 'Embedded Tweets' ) do
152
169
  <p><input type="text" name="twitter_quote.oauth_token" value="#{h @conf["twitter_quote.oauth_token"]}" size="80"></p>
153
170
  <h3>Access token secret</h3>
154
171
  <p><input type="text" name="twitter_quote.oauth_token_secret" value="#{h @conf["twitter_quote.oauth_token_secret"]}" size="80"></p>
172
+ <h3>Render method</h3>
173
+ <select name="twitter_quote.render_method">
174
+ <option value="bbp"#{' selected' if @conf['twitter_quote.render_method'] == 'bbp'}>Bbp</option>
175
+ <option value="widget"#{' selected' if @conf['twitter_quote.render_method'] == 'widget'}>Widget</option>
176
+ </select>
177
+ </p>
155
178
  HTML
156
179
  end
157
180
 
@@ -0,0 +1,56 @@
1
+ # Twitter Summary Card plugin
2
+ #
3
+ #
4
+ # Copyright (c) 2013 Tatsuya Sato <satoryu.1981@gmail.com>
5
+
6
+ def twitter_summary_card_description
7
+ section_index = @cgi.params['p'][0]
8
+ if @mode == 'day' and section_index
9
+ diary = @diaries[@date.strftime('%Y%m%d')]
10
+ sections = diary.instance_variable_get(:@sections)
11
+ section = sections[section_index.to_i - 1].body_to_html
12
+ @conf.shorten(apply_plugin(section, true), 200)
13
+ else
14
+ @conf.description
15
+ end
16
+ end
17
+
18
+ add_header_proc do
19
+ headers = {
20
+ 'twitter:card' => 'summary',
21
+ 'twitter:site' => @conf['twitter_summary_card.site'] || @conf['twitter_summary_card.creator'],
22
+ 'twitter:creator' => @conf['twitter_summary_card.creator'],
23
+ 'twitter:title' => title_tag.match(/>([^<]+)/).to_a[1],
24
+ 'twitter:description' => twitter_summary_card_description,
25
+ 'twitter:image:src' => @conf.banner
26
+ }
27
+ headers = headers.select { |_, v| v && not(v.empty?) }
28
+ headers = headers.map do |k, v|
29
+ %Q|<meta name="#{k}" content="#{CGI.escapeHTML(v)}">|
30
+ end
31
+
32
+ headers.join("\n")
33
+ end
34
+
35
+ add_conf_proc('Twitter Summary Card', 'Twitter Summary Card') do
36
+ if @mode == 'saveconf'
37
+ @conf['twitter_summary_card.site'] = @cgi.params['twitter_summary_card.site'][0]
38
+ @conf['twitter_summary_card.creator'] = @cgi.params['twitter_summary_card.creator'][0]
39
+ end
40
+
41
+ <<-HTML
42
+ <h2>Twitter Summary Card</h2>
43
+ <p>
44
+ Please refer to the following documentation at first.
45
+ <ul>
46
+ <li><a href="https://dev.twitter.com/docs/cards/types/summary-card" target="_blank">Summary Card | Twitter Developers</a></li>
47
+ </ul>
48
+ </p>
49
+
50
+ <h3>Your tDiary's Twitte account</h3>
51
+ <p><input name="twitter_summary_card.site" value="#{h(@conf['twitter_summary_card.site'])}"></p>
52
+
53
+ <h3>Creator's Twitter account </h3>
54
+ <p><input name="twitter_summary_card.creator" value="#{h(@conf['twitter_summary_card.creator'])}"></p>
55
+ HTML
56
+ end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdiary-contrib
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.2.20130614
4
+ version: 4.0.2
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-06-16 00:00:00.000000000 Z
11
+ date: 2013-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tdiary
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.2.2.20130614
19
+ version: 4.0.2
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: 3.2.2.20130614
26
+ version: 4.0.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,14 +42,14 @@ dependencies:
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: tDiary contributions package that includes plugins, styles, utilities,
@@ -228,6 +228,7 @@ files:
228
228
  - plugin/image_gps.rb
229
229
  - plugin/inline_wiki.rb
230
230
  - plugin/instagr.rb
231
+ - plugin/instagram.rb
231
232
  - plugin/ja/add_bookmark.rb
232
233
  - plugin/ja/del_footer.rb
233
234
  - plugin/ja/flickr.rb
@@ -305,6 +306,7 @@ files:
305
306
  - plugin/twitter_anywhere.rb
306
307
  - plugin/twitter_badge.rb
307
308
  - plugin/twitter_js.rb
309
+ - plugin/twitter_summary_card.rb
308
310
  - plugin/ustream.rb
309
311
  - plugin/vimeo.rb
310
312
  - plugin/volatile.rb
@@ -441,17 +443,17 @@ require_paths:
441
443
  - lib
442
444
  required_ruby_version: !ruby/object:Gem::Requirement
443
445
  requirements:
444
- - - '>='
446
+ - - ! '>='
445
447
  - !ruby/object:Gem::Version
446
448
  version: '0'
447
449
  required_rubygems_version: !ruby/object:Gem::Requirement
448
450
  requirements:
449
- - - '>='
451
+ - - ! '>='
450
452
  - !ruby/object:Gem::Version
451
453
  version: '0'
452
454
  requirements: []
453
455
  rubyforge_project:
454
- rubygems_version: 2.0.2
456
+ rubygems_version: 2.1.11
455
457
  signing_key:
456
458
  specification_version: 4
457
459
  summary: tDiary contributions package
@@ -475,3 +477,4 @@ test_files:
475
477
  - spec/title_anchor_spec.rb
476
478
  - spec/twitter_js_spec.rb
477
479
  - spec/youtube_spec.rb
480
+ has_rdoc: