[DRE-commits] [tdiary-contrib] 06/12: Imported Upstream version 4.0.5.1
Hideki Yamane
henrich at moszumanska.debian.org
Wed Nov 25 12:01:43 UTC 2015
This is an automated email from the git hooks/post-receive script.
henrich pushed a commit to branch master
in repository tdiary-contrib.
commit 9d07e622be973130ea2f46b557112f8ee80a0bb8
Author: Hideki Yamane <henrich at debian.org>
Date: Mon Sep 15 11:26:19 2014 +0900
Imported Upstream version 4.0.5.1
---
.travis.yml | 6 +
Gemfile | 10 +-
Gemfile.lock | 38 ++---
README.en.md | 2 +-
filter/commentsize.rb | 2 +-
filter/iplookup.rb | 110 ++++++-------
filter/plugin/commentsize.rb | 2 +-
filter/plugin/en/spambayes.rb | 2 +-
filter/plugin/iplookup.rb | 78 ++++-----
filter/plugin/ja/antirefspam.rb | 2 +-
filter/plugin/ja/spambayes.rb | 2 +-
filter/plugin/spambayes.rb | 2 +-
filter/spambayes.rb | 2 +-
js/flickr.js | 2 +-
lib/bayes.rb | 2 +-
lib/bayes/convert.rb | 2 +-
lib/tdiary/contrib/version.rb | 2 +-
lib/wgs2tky.rb | 186 ++++++++++-----------
plugin/appstore.rb | 12 +-
plugin/bigpresen.rb | 6 +-
plugin/bitly.rb | 2 +-
plugin/brow_si.rb | 2 +-
plugin/category_similar.rb | 2 +-
plugin/category_to_tagcloud.rb | 4 +-
plugin/coderay.rb | 2 +-
plugin/datepicker.rb | 2 +-
plugin/flickr.rb | 4 +-
plugin/git-register.rb | 14 +-
plugin/goo_gl.rb | 14 +-
plugin/google_map.rb | 12 +-
plugin/google_webmaster.rb | 8 +-
plugin/hb_footer.rb | 10 +-
plugin/hb_footer4sec.rb | 10 +-
plugin/hide_sidebar_iphone.rb | 2 +-
plugin/iddy.rb | 2 +-
plugin/image_ex.rb | 34 ++--
plugin/image_gps.rb | 6 +-
plugin/inline_wiki.rb | 12 +-
plugin/instagr.rb | 16 +-
plugin/instagram.rb | 2 +-
plugin/ja/yo_update.rb | 51 ++++++
plugin/jquery_ui_theme.rb | 16 +-
plugin/jroku.rb | 2 +-
plugin/jyear.rb | 4 +-
plugin/makerss_category.rb | 8 +-
plugin/makerss_comment.rb | 8 +-
plugin/microsummary.rb | 4 +-
plugin/nhk_program_info.rb | 4 +-
plugin/picasa.rb | 4 +-
plugin/playstore.rb | 6 +-
plugin/rating.rb | 20 +--
plugin/recent_estraier.rb | 14 +-
plugin/search-bing.rb | 2 +-
plugin/search-google-custom.rb | 2 +-
plugin/search-yahoo-websearch.rb | 16 +-
plugin/search-yahoo.rb | 2 +-
plugin/section_footer2.rb | 2 +-
plugin/show_and_hide.rb | 40 ++---
plugin/socialbutton.rb | 4 +-
plugin/tdiarytimes.rb | 32 ++--
plugin/tdiarytimes2.rb | 20 +--
plugin/tdiarytimes_textstyle.rb | 6 +-
plugin/twitter_anywhere.rb | 102 ++++++------
plugin/twitter_summary_card.rb | 2 +-
plugin/vote.rb | 8 +-
plugin/yahoo_kousei.rb | 4 +-
plugin/yo_update.rb | 214 +++++++++++++++++++++++++
plugin/zenback.rb | 4 +-
spec/apple_webclip_spec.rb | 12 +-
util/estraier-search/estraier-register.rb | 4 +-
util/image-gallery/image-gallery.rb | 16 +-
util/image-gallery/misc/plugin/recent_image.rb | 8 +-
util/posttdiary/posttdiary-ex.rb | 14 +-
util/rast-search/rast-register.rb | 2 +-
74 files changed, 774 insertions(+), 513 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index f8671d1..c467c2b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,8 @@
rvm:
- 1.9.3
- 2.0.0
+ - 2.1
+ - ruby-head
cache: bundler
@@ -8,3 +10,7 @@ script: bundle exec rake spec
notifications:
irc: "irc.freenode.org#tdiary"
+
+matrix:
+ allow_failures:
+ - rvm: ruby-head
diff --git a/Gemfile b/Gemfile
index 421283d..66eae80 100644
--- a/Gemfile
+++ b/Gemfile
@@ -3,11 +3,5 @@ source 'https://rubygems.org'
gem 'tdiary', '~> 4.0.2'
gem 'rake'
-gem 'rspec', '~> 3.0.0.beta2'
-
-platforms :ruby_18 do
- gem 'json'
- gem 'rcov'
-end
-
-gem 'simplecov', :platforms => :ruby_19
+gem 'rspec'
+gem 'simplecov'
diff --git a/Gemfile.lock b/Gemfile.lock
index 9eba8b6..5fe329f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -2,29 +2,27 @@ GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.2.5)
- docile (1.1.3)
- json (1.8.1)
- multi_json (1.9.2)
- rake (10.2.2)
- rcov (1.0.0)
- rspec (3.0.0.beta2)
- rspec-core (= 3.0.0.beta2)
- rspec-expectations (= 3.0.0.beta2)
- rspec-mocks (= 3.0.0.beta2)
- rspec-core (3.0.0.beta2)
- rspec-support (= 3.0.0.beta2)
- rspec-expectations (3.0.0.beta2)
+ docile (1.1.5)
+ multi_json (1.10.1)
+ rake (10.3.2)
+ rspec (3.0.0)
+ rspec-core (~> 3.0.0)
+ rspec-expectations (~> 3.0.0)
+ rspec-mocks (~> 3.0.0)
+ rspec-core (3.0.3)
+ rspec-support (~> 3.0.0)
+ rspec-expectations (3.0.3)
diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (= 3.0.0.beta2)
- rspec-mocks (3.0.0.beta2)
- rspec-support (= 3.0.0.beta2)
- rspec-support (3.0.0.beta2)
- simplecov (0.8.2)
+ rspec-support (~> 3.0.0)
+ rspec-mocks (3.0.3)
+ rspec-support (~> 3.0.0)
+ rspec-support (3.0.3)
+ simplecov (0.9.0)
docile (~> 1.1.0)
multi_json
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
- tdiary (4.0.3)
+ tdiary (4.0.4)
bundler (~> 1.3)
thor (~> 0.18)
thor (0.19.1)
@@ -33,9 +31,7 @@ PLATFORMS
ruby
DEPENDENCIES
- json
rake
- rcov
- rspec (~> 3.0.0.beta2)
+ rspec
simplecov
tdiary (~> 4.0.2)
diff --git a/README.en.md b/README.en.md
index a2bd3c9..439e5da 100644
--- a/README.en.md
+++ b/README.en.md
@@ -5,7 +5,7 @@ See documents in each directories.
See licenses and copyrights in each theme files. If no license
or copyright, it can be distoributed by GPL2, and it has a
-copyright below:
+copyright below:
```
Copyright (c) 2005 TADA Tadashi <t at tdtds.jp>
diff --git a/filter/commentsize.rb b/filter/commentsize.rb
index 54539c0..8b4841d 100644
--- a/filter/commentsize.rb
+++ b/filter/commentsize.rb
@@ -9,7 +9,7 @@ module TDiary
return false if comment.body.size > @conf['comment.size']
true
end
-
+
def referer_filter( referer )
true
end
diff --git a/filter/iplookup.rb b/filter/iplookup.rb
index 03b4796..9bab551 100644
--- a/filter/iplookup.rb
+++ b/filter/iplookup.rb
@@ -1,55 +1,55 @@
-#
-# iplookup.rb: included TDiary::Filter::IplookupFilter class
-#
-#
-# Copyright (c) 2008 SHIBATA Hiroshi <shibata.hiroshi at gmail.com>
-# Distributed under the GPL2
-#
-
-require 'resolv'
-
-module TDiary
- module Filter
- class IplookupFilter < Filter
- def iplookup_init
- if @conf.options.include?('iplookup.ip.list')
- @iplookup_ip_list = @conf.options['iplookup.ip.list']
- else
- @iplookup_ip_list = "bsb.spamlookup.net\nopm.blitzed.org\n" +
- "niku.2ch.net\ndnsbl.spam-champuru.livedoor.com"
- end
- end
-
- def black_ip?( address )
- chance = 2
- ip = address.gsub(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/, '\4.\3.\2.\1')
- @iplookup_ip_list.split(/\n+/).each do |dnsbl|
- begin
- address = Resolv.getaddress( "#{ip}.#{dnsbl}" )
- return true
- rescue Resolv::ResolvTimeout
- if chance > 0
- chance -= 1
- retry
- end
- rescue Resolv::ResolvError
- rescue Exception
- end
- end
- return false
- end
-
- def comment_filter( diary, comment )
- iplookup_init
- return false if black_ip?( @cgi.remote_addr )
- return true
- end
-
- def referer_filter( referer )
- iplookup_init
- return false if black_ip?( @cgi.remote_addr )
- return true
- end
- end
- end
-end
+#
+# iplookup.rb: included TDiary::Filter::IplookupFilter class
+#
+#
+# Copyright (c) 2008 SHIBATA Hiroshi <shibata.hiroshi at gmail.com>
+# Distributed under the GPL2
+#
+
+require 'resolv'
+
+module TDiary
+ module Filter
+ class IplookupFilter < Filter
+ def iplookup_init
+ if @conf.options.include?('iplookup.ip.list')
+ @iplookup_ip_list = @conf.options['iplookup.ip.list']
+ else
+ @iplookup_ip_list = "bsb.spamlookup.net\nopm.blitzed.org\n" +
+ "niku.2ch.net\ndnsbl.spam-champuru.livedoor.com"
+ end
+ end
+
+ def black_ip?( address )
+ chance = 2
+ ip = address.gsub(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/, '\4.\3.\2.\1')
+ @iplookup_ip_list.split(/\n+/).each do |dnsbl|
+ begin
+ address = Resolv.getaddress( "#{ip}.#{dnsbl}" )
+ return true
+ rescue Resolv::ResolvTimeout
+ if chance > 0
+ chance -= 1
+ retry
+ end
+ rescue Resolv::ResolvError
+ rescue Exception
+ end
+ end
+ return false
+ end
+
+ def comment_filter( diary, comment )
+ iplookup_init
+ return false if black_ip?( @cgi.remote_addr )
+ return true
+ end
+
+ def referer_filter( referer )
+ iplookup_init
+ return false if black_ip?( @cgi.remote_addr )
+ return true
+ end
+ end
+ end
+end
diff --git a/filter/plugin/commentsize.rb b/filter/plugin/commentsize.rb
index 7191aa4..b72a6d7 100644
--- a/filter/plugin/commentsize.rb
+++ b/filter/plugin/commentsize.rb
@@ -3,7 +3,7 @@ add_conf_proc( 'comment_size' , @comment_size_conf, 'security') do
@conf['comment.size'] = @cgi.params['comment.size'][0]
end
@conf['comment.size'] = 0 unless @conf['comment.size']
-
+
result = <<-HTML
<h3>#{@comment_size}</h3>
<p>#{@comment_size_desc}</p>
diff --git a/filter/plugin/en/spambayes.rb b/filter/plugin/en/spambayes.rb
index cd2966f..eb433d8 100644
--- a/filter/plugin/en/spambayes.rb
+++ b/filter/plugin/en/spambayes.rb
@@ -1,5 +1,5 @@
# Copyright (C) 2007, KURODA Hiraku <hiraku at hinet.mydns.jp>
-# You can redistribute it and/or modify it under GPL2.
+# You can redistribute it and/or modify it under GPL2.
class SpambayesConfig
module Res
diff --git a/filter/plugin/iplookup.rb b/filter/plugin/iplookup.rb
index 4b56989..23f883d 100644
--- a/filter/plugin/iplookup.rb
+++ b/filter/plugin/iplookup.rb
@@ -1,39 +1,39 @@
-# iplookup.rb
-#
-# Copyright (c) 2005 SHIBATA Hiroshi <h-sbt at nifty.com>
-# Distributed under the GPL
-#
-if TDIARY_VERSION >= '2.1.2.20050825' then
- add_conf_proc( 'iplookup', @iplookup_label, 'security' ) do
- iplookup_conf_proc
- end
-else
- add_conf_proc( 'iplookup', @iplookup_label ) do
- iplookup_conf_proc
- end
-end
-def iplookup_conf_proc
- if @mode == 'saveconf' then
- if @cgi.params['iplookup.ip.list'] && @cgi.params['iplookup.ip.list'][0]
- @conf['iplookup.ip.list'] = @cgi.params['iplookup.ip.list'][0]
- else
- @conf['iplookup.ip.list'] = nil
- end
-
- if @cgi.params['iplookup.safe_ip.list'] && @cgi.params['iplookup.safe_ip.list'][0]
- @conf['iplookup.safe_ip.list'] = @cgi.params['iplookup.safe_ip.list'][0]
- else
- @conf['iplookup.safe_ip.list'] = nil
- end
-
- end
-
- # initialize DNSBL list
- @conf['iplookup.ip.list'] = "bsb.spamlookup.net\nopm.blitzed.org\nniku.2ch.net" unless @conf['iplookup.ip.list']
-
- result = <<-HTML
- <h3>#{@iplookup_ip_label}</h3>
- <p>#{@iplookup_ip_label_desc}</p>
- <p><textarea name="iplookup.ip.list" cols="70" rows="5">#{CGI::escapeHTML( @conf['iplookup.ip.list'] )}</textarea></p>
- HTML
-end
+# iplookup.rb
+#
+# Copyright (c) 2005 SHIBATA Hiroshi <h-sbt at nifty.com>
+# Distributed under the GPL
+#
+if TDIARY_VERSION >= '2.1.2.20050825' then
+ add_conf_proc( 'iplookup', @iplookup_label, 'security' ) do
+ iplookup_conf_proc
+ end
+else
+ add_conf_proc( 'iplookup', @iplookup_label ) do
+ iplookup_conf_proc
+ end
+end
+def iplookup_conf_proc
+ if @mode == 'saveconf' then
+ if @cgi.params['iplookup.ip.list'] && @cgi.params['iplookup.ip.list'][0]
+ @conf['iplookup.ip.list'] = @cgi.params['iplookup.ip.list'][0]
+ else
+ @conf['iplookup.ip.list'] = nil
+ end
+
+ if @cgi.params['iplookup.safe_ip.list'] && @cgi.params['iplookup.safe_ip.list'][0]
+ @conf['iplookup.safe_ip.list'] = @cgi.params['iplookup.safe_ip.list'][0]
+ else
+ @conf['iplookup.safe_ip.list'] = nil
+ end
+
+ end
+
+ # initialize DNSBL list
+ @conf['iplookup.ip.list'] = "bsb.spamlookup.net\nopm.blitzed.org\nniku.2ch.net" unless @conf['iplookup.ip.list']
+
+ result = <<-HTML
+ <h3>#{@iplookup_ip_label}</h3>
+ <p>#{@iplookup_ip_label_desc}</p>
+ <p><textarea name="iplookup.ip.list" cols="70" rows="5">#{CGI::escapeHTML( @conf['iplookup.ip.list'] )}</textarea></p>
+ HTML
+end
diff --git a/filter/plugin/ja/antirefspam.rb b/filter/plugin/ja/antirefspam.rb
index 22b668c..29c299d 100644
--- a/filter/plugin/ja/antirefspam.rb
+++ b/filter/plugin/ja/antirefspam.rb
@@ -1,5 +1,5 @@
#
-# antirefspam.rb
+# antirefspam.rb
#
# Copyright (c) 2004-2005 T.Shimomura <redbug at netlife.gr.jp>
# You can redistribute it and/or modify it under GPL2.
diff --git a/filter/plugin/ja/spambayes.rb b/filter/plugin/ja/spambayes.rb
index 068f967..880684d 100644
--- a/filter/plugin/ja/spambayes.rb
+++ b/filter/plugin/ja/spambayes.rb
@@ -1,5 +1,5 @@
# Copyright (C) 2007, KURODA Hiraku <hiraku at hinet.mydns.jp>
-# You can redistribute it and/or modify it under GPL2.
+# You can redistribute it and/or modify it under GPL2.
class SpambayesConfig
module Res
diff --git a/filter/plugin/spambayes.rb b/filter/plugin/spambayes.rb
index 98fadf6..b34ddc9 100644
--- a/filter/plugin/spambayes.rb
+++ b/filter/plugin/spambayes.rb
@@ -1,5 +1,5 @@
# Copyright (C) 2007, KURODA Hiraku <hiraku at hinet.mydns.jp>
-# You can redistribute it and/or modify it under GPL2.
+# You can redistribute it and/or modify it under GPL2.
require "bayes"
diff --git a/filter/spambayes.rb b/filter/spambayes.rb
index 22c1e4d..aa4efe8 100644
--- a/filter/spambayes.rb
+++ b/filter/spambayes.rb
@@ -1,5 +1,5 @@
# Copyright (C) 2007, KURODA Hiraku <hiraku at hinet.mydns.jp>
-# You can redistribute it and/or modify it under GPL2.
+# You can redistribute it and/or modify it under GPL2.
require "bayes"
diff --git a/js/flickr.js b/js/flickr.js
index 9a0ff61..f467ea9 100644
--- a/js/flickr.js
+++ b/js/flickr.js
@@ -54,7 +54,7 @@ $(function() {
* a Flickr API client for JavaScript
*/
flickrClient = function(apiKey) {
- this.baseUrl = 'http://api.flickr.com/services/rest/?';
+ this.baseUrl = 'https://api.flickr.com/services/rest/?';
this.apiKey = apiKey;
}
diff --git a/lib/bayes.rb b/lib/bayes.rb
index 7db4251..e5a5a45 100644
--- a/lib/bayes.rb
+++ b/lib/bayes.rb
@@ -1,5 +1,5 @@
# Copyright (C) 2007, KURODA Hiraku <hiraku at hinet.mydns.jp>
-# You can redistribute it and/or modify it under GPL2.
+# You can redistribute it and/or modify it under GPL2.
require "pstore"
diff --git a/lib/bayes/convert.rb b/lib/bayes/convert.rb
index 09d51d4..7f9d3d5 100644
--- a/lib/bayes/convert.rb
+++ b/lib/bayes/convert.rb
@@ -1,5 +1,5 @@
# Copyright (C) 2008, KURODA Hiraku <hiraku at hinet.mydns.jp>
-# You can redistribute it and/or modify it under GPL2.
+# You can redistribute it and/or modify it under GPL2.
require "bayes"
require "kconv"
diff --git a/lib/tdiary/contrib/version.rb b/lib/tdiary/contrib/version.rb
index 3b6427a..36de646 100644
--- a/lib/tdiary/contrib/version.rb
+++ b/lib/tdiary/contrib/version.rb
@@ -1,5 +1,5 @@
module TDiary
class Contrib
- VERSION = "4.0.3"
+ VERSION = "4.0.5.1"
end
end
diff --git a/lib/wgs2tky.rb b/lib/wgs2tky.rb
index 29d322c..e06758d 100644
--- a/lib/wgs2tky.rb
+++ b/lib/wgs2tky.rb
@@ -1,93 +1,93 @@
-#
-# wgs2tky.rb
-# -- GPS data converter
-#
-# kp<kp at mmho.no-ip.org>
-# Destributed under the GPL
-
-class Wgs2Tky
-
- Pi = Math::PI
- Rd = Pi/180
-
- # WGS84
- A = 6378137.0 # 赤道半径
- F = 1/298.257223563 # 扁平率
- E2 = F*2 - F*F # 第一離心率
-
- # Tokyo
- A_ = 6378137.0 - 739.845 # 6377397.155
- F_ = 1/298.257223563 - 0.000010037483
- # 1 / 299.152813
- E2_ = F_*2 - F_*F_
-
- Dx = +128
- Dy = -481
- Dz = -664
-
- def Wgs2Tky.conv!(lat,lon,h = 0)
- b = lat[0].to_f + lat[1].to_f/60 + lat[2].to_f/3600
- l = lon[0].to_f + lon[1].to_f/60 + lon[2].to_f/3600
-
- (x,y,z) = Wgs2Tky._llh2xyz(b,l,h,A,E2)
-
- x+=Dx
- y+=Dy
- z+=Dz
-
- (b,l,h) = Wgs2Tky._xyz2llh(x,y,z,A_,E2_)
-
- lat[0..2]=Wgs2Tky._deg2gdms(b)
- lon[0..2]=Wgs2Tky._deg2gdms(l)
- end
-
- private
-
- include Math
- extend Math
-
- def Wgs2Tky._llh2xyz(b,l,h,a,e2)
-
- b *= Rd
- l *= Rd
-
- sb = sin(b)
- cb = cos(b)
-
- rn = a / Math.sqrt(1-e2*sb*sb)
-
- x = (rn+h)*cb*cos(l)
- y = (rn+h)*cb*sin(l)
- z = (rn*(1-e2)+h) * sb
-
- return x,y,z
- end
-
- def Wgs2Tky._xyz2llh(x,y,z,a,e2)
-
- bda = sqrt(1-e2)
-
- po = sqrt(x*x+y*y)
- t = atan2(z,po*bda)
- st = sin(t)
- ct = cos(t)
- b = atan2(z+e2*a/bda*st*st*st,po-e2*a*ct*ct*ct)
- l = atan2(y,x)
-
- sb = sin(b)
- rn = a / sqrt(1-e2*sb*sb)
- h = po / cos(b) - rn
-
- return b/Rd,l/Rd,h
- end
-
- def Wgs2Tky._deg2gdms(deg)
- sf = deg*3600
- s = sf.to_i%60
- m = (sf/60).to_i%60
- d = (sf/3600).to_i
- s += sf - sf.to_i
- return d,m,s
- end
-end
-
+#
+# wgs2tky.rb
+# -- GPS data converter
+#
+# kp<kp at mmho.no-ip.org>
+# Destributed under the GPL
+
+class Wgs2Tky
+
+ Pi = Math::PI
+ Rd = Pi/180
+
+ # WGS84
+ A = 6378137.0 # 赤道半径
+ F = 1/298.257223563 # 扁平率
+ E2 = F*2 - F*F # 第一離心率
+
+ # Tokyo
+ A_ = 6378137.0 - 739.845 # 6377397.155
+ F_ = 1/298.257223563 - 0.000010037483
+ # 1 / 299.152813
+ E2_ = F_*2 - F_*F_
+
+ Dx = +128
+ Dy = -481
+ Dz = -664
+
+ def Wgs2Tky.conv!(lat,lon,h = 0)
+ b = lat[0].to_f + lat[1].to_f/60 + lat[2].to_f/3600
+ l = lon[0].to_f + lon[1].to_f/60 + lon[2].to_f/3600
+
+ (x,y,z) = Wgs2Tky._llh2xyz(b,l,h,A,E2)
+
+ x+=Dx
+ y+=Dy
+ z+=Dz
+
+ (b,l,h) = Wgs2Tky._xyz2llh(x,y,z,A_,E2_)
+
+ lat[0..2]=Wgs2Tky._deg2gdms(b)
+ lon[0..2]=Wgs2Tky._deg2gdms(l)
+ end
+
+ private
+
+ include Math
+ extend Math
+
+ def Wgs2Tky._llh2xyz(b,l,h,a,e2)
+
+ b *= Rd
+ l *= Rd
+
+ sb = sin(b)
+ cb = cos(b)
+
+ rn = a / Math.sqrt(1-e2*sb*sb)
+
+ x = (rn+h)*cb*cos(l)
+ y = (rn+h)*cb*sin(l)
+ z = (rn*(1-e2)+h) * sb
+
+ return x,y,z
+ end
+
+ def Wgs2Tky._xyz2llh(x,y,z,a,e2)
+
+ bda = sqrt(1-e2)
+
+ po = sqrt(x*x+y*y)
+ t = atan2(z,po*bda)
+ st = sin(t)
+ ct = cos(t)
+ b = atan2(z+e2*a/bda*st*st*st,po-e2*a*ct*ct*ct)
+ l = atan2(y,x)
+
+ sb = sin(b)
+ rn = a / sqrt(1-e2*sb*sb)
+ h = po / cos(b) - rn
+
+ return b/Rd,l/Rd,h
+ end
+
+ def Wgs2Tky._deg2gdms(deg)
+ sf = deg*3600
+ s = sf.to_i%60
+ m = (sf/60).to_i%60
+ d = (sf/3600).to_i
+ s += sf - sf.to_i
+ return d,m,s
+ end
+end
+
diff --git a/plugin/appstore.rb b/plugin/appstore.rb
index 7ace569..1aca1de 100644
--- a/plugin/appstore.rb
+++ b/plugin/appstore.rb
@@ -16,24 +16,24 @@ end
def appstore_detail(url)
appstore_dom = ''
-
+
begin
appstore_dom = appstore_common(url, {:detail => true})
-
+
rescue
appstore_dom = "<b>Error. message=#{$!.message}.</b>"
-
+
end
-
+
end
def appstore_common(url, params)
return %Q|<a href="url">#{url}</a>| if feed?
-
+
appstore_uri = URI::parse(url)
id = appstore_uri.path.split('/').last.gsub('id', '')
raise StandardError.new("AppStore ID: not found from #{url}..") if id.nil? || id == ''
-
+
return %Q|<a class="appstore" data-appstoreid="#{id}" href="#{url}"></a>|
end
diff --git a/plugin/bigpresen.rb b/plugin/bigpresen.rb
index 77bc852..b2d8e79 100644
--- a/plugin/bigpresen.rb
+++ b/plugin/bigpresen.rb
@@ -12,7 +12,7 @@
# ʸ���Υ������ϡ�ɽ���ƥ����Ȥȥ��饤�ɤΥ������˹礦�褦��ưŪ��Ĵ������ޤ���
# JavaScript��DHTML���Ѥ���ư�����Τǡ������Ķ��ˤ�äƤ�ɽ������ʤ����Ȥ⤢��ޤ���
#
-# Copyright (c) 2006 Maripo Goda
+# Copyright (c) 2006 Maripo Goda
# mailto:madin at madin.jp
# Document URL http://www.madin.jp/works/plugin.html
# You can redistribute it and/or modify it under GPL2.
@@ -44,7 +44,7 @@ function #{scriptID} () {
maxPx = Math.min(maxPx, w#{scriptID} * 2 * 0.9 / countLength(msgArr[t]));
}
maxPx = Math.min(maxPx, Math.floor(h#{scriptID} * 0.8 / msgArr.length));
- with (document.getElementById("#{scriptID}")) {
+ with (document.getElementById("#{scriptID}")) {
innerHTML = msg#{scriptID}[t#{scriptID}];
style.fontSize = maxPx+"px";
style.top = ((h#{scriptID}-(maxPx * msgArr.length)) / 2) + "px";
@@ -61,7 +61,7 @@ function #{scriptID} () {
}
}
-function countLength (str)
+function countLength (str)
{
len = 0;
for (i = 0; i < str.length; i++) {
diff --git a/plugin/bitly.rb b/plugin/bitly.rb
index bb5ffd5..87187fb 100644
--- a/plugin/bitly.rb
+++ b/plugin/bitly.rb
@@ -5,7 +5,7 @@
# (because bitly returns nil sometime.)
#
# required some options below:
-# @options['biyly.login'] : your login ID of bit.ly.
+# @options['biyly.login'] : your login ID of bit.ly.
# @options['biyly.key'] : your API key of biy.ly.
#
# Copyright (C) 2010, TADA Tadashi <t at tdtds.jp>
diff --git a/plugin/brow_si.rb b/plugin/brow_si.rb
index 7f04dd7..f0e6aa6 100644
--- a/plugin/brow_si.rb
+++ b/plugin/brow_si.rb
@@ -17,7 +17,7 @@ end
add_footer_proc do
if @conf["brow.si.site_id"] and @conf.smartphone?
-
+
<<-SCRIPT
<script type="text/javascript">
window['_brSiteId'] = '#{h @conf["brow.si.site_id"]}';
diff --git a/plugin/category_similar.rb b/plugin/category_similar.rb
index cbb3b8c..a4ec7f0 100644
--- a/plugin/category_similar.rb
+++ b/plugin/category_similar.rb
@@ -21,7 +21,7 @@ def category_similar(categories, max_item)
items << %Q|<a href="#{h @index}#{anchor "#{ymd}#p#{'%02d' % idx}"}" title="#{h excerpt}">#{t}#p#{'%02d' % idx}</a> #{apply_plugin(title)}|
end
end
-
+
unless items.empty?
'<div class="section">' +
"<h3 class='category-similar'>#{category_similar_label}</h3>" +
diff --git a/plugin/category_to_tagcloud.rb b/plugin/category_to_tagcloud.rb
index 9dea5de..0ab8f43 100644
--- a/plugin/category_to_tagcloud.rb
+++ b/plugin/category_to_tagcloud.rb
@@ -149,13 +149,13 @@ if category_enable?
now_year = Time.now.year
now_month = Time.now.month
r = Hash.new
-
+
months = [
['01'],['01','02'],['01','02','03'],['02','03','04'],['03','04','05'],
['04','05','06'],['05','06','07'],['06','07','08'],['07','08','09'],
['08','09','10'],['09','10','11'],['10','11','12']
][now_month - 1]
-
+
r[now_year.to_s] = months
case now_month
when 1
diff --git a/plugin/coderay.rb b/plugin/coderay.rb
index 9d03045..ee5c8a5 100644
--- a/plugin/coderay.rb
+++ b/plugin/coderay.rb
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# coderay.rb - easy syntax highlighting for selected languages
-# refer to the URL below.
+# refer to the URL below.
# http://coderay.rubychan.de/
#
# Copyright (C) 2013, tamoot <tamoot+tdiary at gmail.com>
diff --git a/plugin/datepicker.rb b/plugin/datepicker.rb
index cc80939..453b2d0 100644
--- a/plugin/datepicker.rb
+++ b/plugin/datepicker.rb
@@ -8,7 +8,7 @@
#
# not support
-#
+#
return if feed? || @conf.mobile_agent?
if /\A(?:form|preview|append|edit|update)\z/ =~ @mode
diff --git a/plugin/flickr.rb b/plugin/flickr.rb
index 40edd98..2b8ea29 100644
--- a/plugin/flickr.rb
+++ b/plugin/flickr.rb
@@ -96,7 +96,7 @@ def flickr_open(method, photo_id)
Dir::mkdir(cache_dir) unless File::directory?(cache_dir)
file = "#{cache_dir}/#{photo_id}.#{method}"
- unless File.exist?(file)
+ if !File.exist?(file) || File.size(file) == 0
req = Flickr::Request.new(@conf['flickr.apikey'])
req['method'] = method
req['photo_id'] = photo_id
@@ -106,7 +106,7 @@ def flickr_open(method, photo_id)
fout.puts req.open
}
end
- rescue TimeoutError => e
+ rescue TimeoutError, OpenSSL::OpenSSLError => e
File.delete(file)
raise e
end
diff --git a/plugin/git-register.rb b/plugin/git-register.rb
index 0da0400..a481c74 100644
--- a/plugin/git-register.rb
+++ b/plugin/git-register.rb
@@ -6,7 +6,7 @@
# You can redistribute it and/or modify it under GPL2.
#
# tDiaryのデータを日別でGitに登録するプラグインです
-#
+#
# 1. プラグインディレクトリ(例: plugin)にgit-register.rbを設置。
# 2. プラグインディレクトリにja/git-register.rb、en/git-register.rbを設置。
# 3. tdiary.confにリポジトリを指定(リポジトリの場所を/var/git-respoと仮定)
@@ -113,16 +113,16 @@ module ::TDiary
# commit
require 'shellwords'
-
- msg = "#{ENV['REMOTE_ADDR']} - #{ENV['REMOTE_HOST']}"
-
+
+ msg = "#{ENV['REMOTE_ADDR']} - #{ENV['REMOTE_HOST']}"
+
Dir.chdir("#{@repository_dir}") do
td2_file2 = @date.strftime("%Y%m/%Y%m%d.td2")
system("git add -- #{Shellwords.shellescape(td2_file2)}".untaint)
system("git commit -q -m \"#{msg}\" -- #{Shellwords.shellescape(td2_file2)}".untaint)
end
end
-
+
protected
def mode; 'day'; end
@@ -199,9 +199,9 @@ else
conf.show_nyear = false
def conf.bot?; true; end
- repository_dir = @conf['git.repository_dir']
+ repository_dir = @conf['git.repository_dir']
diary = @diaries[@date.strftime('%Y%m%d')]
-
+
TDiary::GitRegister.new(repository_dir, diary).execute
end
diff --git a/plugin/goo_gl.rb b/plugin/goo_gl.rb
index d40df33..859e773 100644
--- a/plugin/goo_gl.rb
+++ b/plugin/goo_gl.rb
@@ -12,18 +12,18 @@ require 'net/https'
def goo_gl( long_url )
return nil if !long_url or long_url.empty?
-
+
# on memory
@goo_gl_cache ||= {} # cached only on memory
return @goo_gl_cache[long_url] if @goo_gl_cache[long_url]
-
+
# proxy
px_host, px_port = (@conf['proxy'] || '').split( /:/ )
px_port = 80 if px_host and !px_port
-
+
# params
params = {'longUrl' => long_url}.to_json
-
+
https = nil
begin
https = Net::HTTP::Proxy(px_host, px_port).new('www.googleapis.com', 443)
@@ -32,11 +32,11 @@ def goo_gl( long_url )
@goo_gl_cache[long_url] = JSON::parse(body)["id"] if res.code == '200'
rescue Exception => e
# do nothing..
-
+
ensure
https.finish if https && https.started?
-
+
end
-
+
return @goo_gl_cache[long_url]
end
diff --git a/plugin/google_map.rb b/plugin/google_map.rb
index d216922..fd4bb5e 100644
--- a/plugin/google_map.rb
+++ b/plugin/google_map.rb
@@ -27,7 +27,7 @@ def google_map_common(params)
return %Q|<a href="#{url}">#{url}</a>|
end
return 'not support this environment.' if @conf.mobile_agent?
-
+
params[:zoom] ||= 10
params[:html] ||= nil
params[:title] ||= nil
@@ -36,7 +36,7 @@ def google_map_common(params)
params[:address] ||= nil
params[:type] ||= :ROADMAP
params[:overview]||= false
-
+
dom_id = "#{@date.strftime("%Y%m")}_#{@gmap_count}"
params.merge!(:id => dom_id)
params.merge!(:width => 240, :height => 180) if @conf.iphone?
@@ -96,7 +96,7 @@ def google_map_script(hash)
if hash[:title]
str << %Q| var marker = new google.maps.Marker({\n|
str << %Q| position: new google.maps.LatLng(#{hash[:lat]}, #{hash[:lon]}),\n|
- str << %Q| map: gMap,\n|
+ str << %Q| map: gMap,\n|
str << %Q| title: '#{hash[:title]}'\n|
str << %Q| });\n|
# set InfoWindow
@@ -109,7 +109,7 @@ def google_map_script(hash)
end # :html
end # :title
str << %Q|});\n|
-
+
str
end
@@ -137,7 +137,7 @@ def google_geomap_script(hash)
if hash[:title]
str << %Q| var marker = new google.maps.Marker({\n|
str << %Q| position: geoLat,\n|
- str << %Q| map: gMap,\n|
+ str << %Q| map: gMap,\n|
str << %Q| title: '#{hash[:title]}'\n|
str << %Q| });\n|
# set InfoWindow
@@ -155,7 +155,7 @@ def google_geomap_script(hash)
str << %Q| });\n|
str << %Q| }\n|
str << %Q|});\n|
-
+
str
end
diff --git a/plugin/google_webmaster.rb b/plugin/google_webmaster.rb
index e1fdf92..84d8e9d 100644
--- a/plugin/google_webmaster.rb
+++ b/plugin/google_webmaster.rb
@@ -1,16 +1,16 @@
# encoding: utf-8
-# google-webmaster.rb - embed a meta tag to let Google Webmaster tool know your verification code.
-#
+# google-webmaster.rb - embed a meta tag to let Google Webmaster tool know your verification code.
+#
# Copyright (C) 2012, Tatsuya Sato <satoryu.1981 at gmail.com>
# You can redistribute it and/or modify it under GPL2.
#
add_header_proc do
- "<meta name=\"google-site-verification\" content=\"#{h @conf['google_webmaster.verification']}\" />"
+ "<meta name=\"google-site-verification\" content=\"#{h @conf['google_webmaster.verification']}\" />"
end
add_conf_proc('Google Webmaster', 'Google ウェブマスターツール', 'etc') do
- if @mode == 'saveconf'
+ if @mode == 'saveconf'
@conf['google_webmaster.verification'] = @cgi.params['google_webmaster.verification'][0]
end
<<-HTML
diff --git a/plugin/hb_footer.rb b/plugin/hb_footer.rb
index 6afbe62..204fe93 100644
--- a/plugin/hb_footer.rb
+++ b/plugin/hb_footer.rb
@@ -35,7 +35,7 @@ add_body_leave_proc(Proc.new do |date|
end
end)
-# rss-recent.rb: RSS recent plugin
+# rss-recent.rb: RSS recent plugin
#
# rss_recnet: show recnet list from RSS
# parameters (default):
@@ -72,11 +72,11 @@ def hb_footer(url, max = 5, cache_time = 3600, \
cache_file = "#{@cache_path}/rss-recent.#{CGI.escape(url)}"
hb_footer_cache_rss(url, cache_file, cache_time.to_i)
-
+
return '' unless test(?r, cache_file)
rv = template_head
-
+
i = 0
hb_footer_read_from_cache(cache_file).each do |title, url, time, content, description|
break if i >= max
@@ -111,14 +111,14 @@ def hb_footer_cache_rss(url, cache_file, cache_time)
require 'rss/2.0'
require 'rss/dublincore'
require 'rss/content'
-
+
begin
uri = URI.parse(url)
raise URI::InvalidURIError if uri.scheme != "http"
rss_source = hb_footer_fetch_rss(uri, cached_time)
-
+
raise InvalidResourceError if rss_source.nil?
# parse RSS
diff --git a/plugin/hb_footer4sec.rb b/plugin/hb_footer4sec.rb
index acf8cd2..bda6d20 100644
--- a/plugin/hb_footer4sec.rb
+++ b/plugin/hb_footer4sec.rb
@@ -24,7 +24,7 @@ add_section_leave_proc do |date, index|
hb_footer4sec(rss_url, 50, cache_time, template_head, template_list, template_foot)
end
-# rss-recent.rb: RSS recent plugin
+# rss-recent.rb: RSS recent plugin
#
# rss_recnet: show recnet list from RSS
# parameters (default):
@@ -61,11 +61,11 @@ def hb_footer4sec(url, max = 5, cache_time = 3600, \
cache_file = "#{@cache_path}/rss-recent.#{CGI.escape(url)}"
hb_footer4sec_cache_rss(url, cache_file, cache_time.to_i)
-
+
return '' unless test(?r, cache_file)
rv = template_head
-
+
i = 0
hb_footer4sec_read_from_cache(cache_file).each do |title, url, time, content, description|
break if i >= max
@@ -100,14 +100,14 @@ def hb_footer4sec_cache_rss(url, cache_file, cache_time)
require 'rss/2.0'
require 'rss/dublincore'
require 'rss/content'
-
+
begin
uri = URI.parse(url)
raise URI::InvalidURIError if uri.scheme != "http"
rss_source = hb_footer4sec_fetch_rss(uri, cached_time)
-
+
raise InvalidResourceError if rss_source.nil?
# parse RSS
diff --git a/plugin/hide_sidebar_iphone.rb b/plugin/hide_sidebar_iphone.rb
index a035bc8..d20d832 100644
--- a/plugin/hide_sidebar_iphone.rb
+++ b/plugin/hide_sidebar_iphone.rb
@@ -8,7 +8,7 @@ add_header_proc do
if @conf.iphone? then
<<-CSS
<style type="text/css"><!--
- div.sidebar {
+ div.sidebar {
display: none;
}
div.main {
diff --git a/plugin/iddy.rb b/plugin/iddy.rb
index 6e6fd85..75b9fb2 100644
--- a/plugin/iddy.rb
+++ b/plugin/iddy.rb
@@ -47,7 +47,7 @@ def iddy( id )
nameroma = user.to_a( 'nameroma' )[0]
mail = user.to_a( 'mail' )[0]
submail = user.to_a( 'submail' )[0]
-
+
html = '<div class="iddy">'
html << %Q|<a href="#{profileurl.text}">|
html << %Q|<span class="iddy-image"><img src="#{imageurl.text}" alt="image" width="96" height="96"></span>| if imageurl
diff --git a/plugin/image_ex.rb b/plugin/image_ex.rb
index 13e1e64..50a650b 100644
--- a/plugin/image_ex.rb
+++ b/plugin/image_ex.rb
@@ -1,7 +1,7 @@
# image_plugin_ex.rb
# version 0.3
# -pv-
-#
+#
# 名称:
# 絵日記Plugin機能追加版
#
@@ -89,7 +89,7 @@ if @conf.smartphone?
end
-add_body_enter_proc(Proc.new do |date|
+add_body_enter_proc(Proc.new do |date|
@image_date = date.strftime("%Y%m%d")
@image_year = date.strftime("%Y")
""
@@ -110,10 +110,10 @@ def image( id, alt = "image", id2 = nil, width = nil, place="none" )
image_dir.untaint
Dir.mkdir(image_dir) unless File.directory?(image_dir)
-
+
list = imageList(@image_date, image_dir).untaint
slist = imageList(@image_date, image_dir, "s").untaint
-
+
if width
width_tag = %Q[width="#{h width}"]
else
@@ -194,7 +194,7 @@ add_form_proc do |date|
def resize_image(orig, new, width, height, imageex_convertedwidth, imageex_convertedheight, orig_type, new_type)
imageex_convertpath = @options && @options['image_ex.convertpath'] || "convert"
imageex_convertpath
-
+
if width > height
imageex_convertedsize = %Q[#{imageex_convertedwidth}x#{imageex_convertedheight}]
imageex_convertedsize
@@ -217,16 +217,16 @@ add_form_proc do |date|
giftopnm = @options && @options['image_ex.giftopnmpath'] || "giftopnm"
tifftopnm = @options && @options['image_ex.tifftopnmpath'] || "tifftopnm"
bmptopnm = @options && @options['image_ex.bmptopnmpath'] || "bmptopnm"
-
+
downtype = orig_type.downcase
topnm = eval("#{downtype}topnm")
-
+
if new_type == "jpg"
pnmto = pnmtojpeg
elsif new_type == "png"
pnmto = pnmtopng
end
-
+
if width > height
imageex_convertedsize ="#{imageex_convertedwidth}"
else
@@ -252,7 +252,7 @@ add_form_proc do |date|
}
return image_path
end
-
+
if @cgi.params['plugin_image_add'][0] && @cgi.params['plugin_image_file'][0].original_filename != ''
image_dir = @cgi.params['plugin_image_dir'][0].read.untaint
image_filename = ''
@@ -271,7 +271,7 @@ add_form_proc do |date|
f.print @cgi.params['plugin_image_file'][0].read
}
end
-
+
if imageex_useresize == 1 or imageex_useresize == 2
open(image_file,"rb") do |fh|
img = ImageSize.new(fh.read)
@@ -291,7 +291,7 @@ add_form_proc do |date|
elsif imageex_converttype == 1
new_type = "png"
end
-
+
if width
if width > imageex_thresholdsize or height > imageex_thresholdsize
small_image_file = %Q[#{image_dir}s#{image_date}_#{image_name.length.to_s}.#{new_type}]
@@ -367,10 +367,10 @@ add_form_proc do |date|
n_image = imageList(@date.strftime("%Y%m%d"), image_dir).length
list = imageList(@date.strftime("%Y%m%d"), image_dir)
slist = imageList(@date.strftime("%Y%m%d"), image_dir, "s")
-
+
pretable=""
posttable=""
-
+
if n_image > 0
pretable<< %Q[<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">]
posttable << %Q[</TR></TABLE>]
@@ -386,7 +386,7 @@ add_form_proc do |date|
image_plugin_tag1 = "<%="
image_plugin_tag2 = "%>"
end
-
+
r = ''
r << %Q[
<script type="text/javascript">
@@ -416,14 +416,14 @@ add_form_proc do |date|
alt_tag = %Q[alt="#{h list[id.to_i]}"]
thumbnail_tag = %Q[<form class="update" method="post" enctype="multipart/form-data" action="#{h @update}">#{csrf_protection}<input type="hidden" name="plugin_image_name" value="#{date.strftime( '%Y%m%d' )}_#{h id}"><input type="hidden" name="plugin_image_dir" value="#{h image_dir}"><input type="hidden" name="plugin_image_thumbnail" value="true"><input type="hidden" name="date" value="#{date.strftime( '%Y%m%d' )}"><input type="file" name="plugin_image_file"><input type="submit" name="p [...]
end
-
+
ptag = "#{image_plugin_tag1}image #{id}, '画像の説明'#{image_plugin_tag2}"
-
+
i<< %Q[<td><table border="1" cellpadding="1" cellspacing="1"><tr><td style="text-align:center"><input type="button" onclick="ins("#{ptag}")" value="本文に追加"></td></tr><tr><td style="text-align:center">#{image_plugin_tag1}image #{h id},'title#{h id}'#{image_plugin_tag2}</td></tr><tr><td width="#{@imageex_thumbnailsize * 1.5}" height="#{@imageex_thumbnailsize * 1.3}" style="text-align:center">
<img class="form" #{src_tag} #{alt_tag} height="#{@imageex_thumbnailsize}" ></tr><tr><td>#{thumbnail_tag}<form class="update" method="post" action="#{h @update}">#{csrf_protection}<input type="hidden" name="plugin_image_del" value="true"><input type="hidden" name="date" value="#{date.strftime( '%Y%m%d' )}"><input type="hidden" name="plugin_image_id" value="#{h id}"><input type="submit" name="plugin" value="画像を削除"><input type="hidden" name="plugin_image_dir" value="#{h image_dir}"></form>
</tr></table></td>] if slist[id.to_i] || list[id.to_i]
nt += 1 if slist[id.to_i] || list[id.to_i]
-
+
if nt > 0 and nt%2 == 0
i<< %Q[</TR></TABLE><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD>]
end
diff --git a/plugin/image_gps.rb b/plugin/image_gps.rb
index 5ea007f..a612a4d 100644
--- a/plugin/image_gps.rb
+++ b/plugin/image_gps.rb
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
# image_gps.rb $Revision: 1.1 $
-#
+#
# 概要:
-#
+#
#
# 使い方:
# 絵日記Plugin(image.rb)とおなじ
@@ -52,7 +52,7 @@ def image( id, alt = 'image', thumbnail = nil, size = nil, place = 'photo' )
else
size = ""
end
-
+
show_exif_info = @conf['image_gps.show_exif_info']
show_exif_info = '' if show_exif_info.nil?
google_maps_api_key = @conf['image_gps.google_maps_api_key']
diff --git a/plugin/inline_wiki.rb b/plugin/inline_wiki.rb
index 1e0cd13..8eb13e3 100644
--- a/plugin/inline_wiki.rb
+++ b/plugin/inline_wiki.rb
@@ -1,6 +1,6 @@
-# Copyright (C) 2009 Hideki Sakamoto <hs at on-sky.net>
-require 'hikidoc'
-
-def inline_wiki(buf)
- HikiDoc::to_html(buf)
-end
+# Copyright (C) 2009 Hideki Sakamoto <hs at on-sky.net>
+require 'hikidoc'
+
+def inline_wiki(buf)
+ HikiDoc::to_html(buf)
+end
diff --git a/plugin/instagr.rb b/plugin/instagr.rb
index e360e55..94c9c78 100644
--- a/plugin/instagr.rb
+++ b/plugin/instagr.rb
@@ -4,11 +4,11 @@
#
# Copyright (C) 2011, tamoot <tamoot+tdiary at gmail.com>
# You can redistribute it and/or modify it under GPL2.
-#
-# usage:
+#
+# usage:
# <%= instagr 'short URL instag.ram' =>
# <%= instagr 'short URL instag.ram', size} =>
-#
+#
# available size option:
# :small => 150x150 pixel
# :medium => 306x306 pixel (default)
@@ -21,26 +21,26 @@ require 'net/http'
def instagr( short_url, size = :medium)
return %Q|<p>Argument is empty.. #{short_url}</p>| if !short_url or short_url.empty?
option = option.nil? ? {} : option
-
+
# img size
size = size.to_sym if size != :medium
maxwidth_data = {:small => 150, :medium => 306, :large => 612}
maxwidth = maxwidth_data[ size ] ? maxwidth_data[ size ] : maxwidth_data[:medium]
-
+
# proxy
px_host, px_port = (@conf['proxy'] || '').split( /:/ )
px_port = 80 if px_host and !px_port
-
+
# query
query = "?url=#{CGI::escape(short_url)}&maxwidth=#{maxwidth}"
-
+
begin
Net::HTTP.version_1_2
res = Net::HTTP::Proxy(px_host, px_port).get('instagram.com', "/api/v1/oembed/#{query}")
json_data = JSON::parse( res, &:read )
width = option[:width] ? option[:width] : json_data["width"]
height = option[:height] ? option[:height] : json_data["height"]
-
+
return <<-INSTAGR_DOM
<div class="instagr">
<a class="instagr" href="#{h short_url}" title="#{h @conf.to_native(json_data["title"])}">
diff --git a/plugin/instagram.rb b/plugin/instagram.rb
index f70aff2..582cd9c 100644
--- a/plugin/instagram.rb
+++ b/plugin/instagram.rb
@@ -1,6 +1,6 @@
# instagram.rb - embed your photo/videos in instagram to a diary
#
-# Author: Tatsuya Sato
+# Author: Tatsuya Sato
# License: GPL
def instagram(code, width=612, height=700)
diff --git a/plugin/ja/yo_update.rb b/plugin/ja/yo_update.rb
new file mode 100644
index 0000000..89a5e09
--- /dev/null
+++ b/plugin/ja/yo_update.rb
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+#
+# yo_update.rb - Japanese resourc
+#
+# Copyright (C) 2014, zunda <zundan at gmail.com>
+#
+# Permission is granted for use, copying, modification,
+# distribution, and distribution of modified versions of this
+# work under the terms of GPL version 2 or later.
+#
+
+def yo_update_conf_label
+ '更新時にYoを送る'
+end
+
+def yo_update_test_result_label(username, result)
+ "- <tt>#{h username}</tt> に Yo を送りました: <tt>#{h result}</tt>"
+end
+
+def yo_update_conf_html(conf, n_subscribers, test_result)
+ action_label = {
+ 'send_on_update' => '日記が追加された時',
+ 'send_on_comment' => 'ツッコミされた時',
+ }
+ <<-HTML
+ <h3 class="subtitle">API key</h3>
+ <p><input name="yo_update.api_key" value="#{h conf['yo_update.api_key']}" size="40"></p>
+ <h3 class="subtitle">Username</h3>
+ <p><input name="yo_update.username" value="#{h conf['yo_update.username']}" size="40"></p>
+ <h3 class="subtitle">Yo を送るタイミング</h3>
+ <ul>
+ #{%w(send_on_update send_on_comment).map{|action|
+ checked = conf["yo_update.#{action}"] ? ' checked' : ''
+ %Q|<li><label for="yo_update.#{action}"><input id="yo_update.#{action}" name="yo_update.#{action}" value="t" type="checkbox"#{checked}>#{action_label[action]}</label>|
+ }.join("\n\t")}
+ </ul>
+ <p>Yo を<input name="yo_update.test" value="" size="10">に送ってみる#{test_result}</p>
+ <h3 class="subtitle">現在の受信者数</h3>
+ <p>#{h n_subscribers}</p>
+ <h3 class="subtitle">Yoボタン</h3>
+ <p>ページのどこかに下記を追加してください</p>
+ <pre><div id="yo-button"></div></pre>
+ <h3 class="subtitle">やり方</h3>
+ <ol>
+ <li>個人用 Yo アカウントで <a href="http://dev.justyo.co/">http://dev.justyo.co/</a> にログインする
+ <li>ページ内の指示に従って APIアカウントを作成する。
+ Callback URL は空白のままにしてください
+ <li>API key と API username を上にコピーする
+ </ol>
+ HTML
+end
diff --git a/plugin/jquery_ui_theme.rb b/plugin/jquery_ui_theme.rb
index 07647a7..81d46da 100644
--- a/plugin/jquery_ui_theme.rb
+++ b/plugin/jquery_ui_theme.rb
@@ -8,24 +8,24 @@
#
# not support
-#
+#
return if feed? || @conf.mobile_agent?
add_header_proc do
if /\A(?:form|preview|append|edit|update)\z/ =~ @mode
-
+
themes = @conf['jquery_ui.theme']
if themes.nil? || theme == ''
themes = 'base'
end
-
+
jquery_ui = ''
jquery_ui << %Q|<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/#{themes.downcase}/jquery-ui.css"/>\n|
jquery_ui
-
+
else
''
-
+
end
end
@@ -33,16 +33,16 @@ end
add_conf_proc( 'jquery_ui_theme', 'jQuery UI Theme' ) do
if @mode == 'saveconf' then
@conf['jquery_ui.theme'] = @cgi.params['jquery_ui.theme'][0]
-
+
end
-
+
<<-HTML
<h3 class="subtitle">Theme name</h3>
<p><input name="jquery_ui.theme" value="#{h @conf['jquery_ui.theme']}" size="40"></p>
<p>sample) blitzer, flick .. <a href="http://jqueryui.com/themeroller/">See JQuery UI Theme.</a></p>
<p>default is <b>base</b>.</p>
HTML
-
+
end
diff --git a/plugin/jroku.rb b/plugin/jroku.rb
index 6ac8fdc..19e23ea 100644
--- a/plugin/jroku.rb
+++ b/plugin/jroku.rb
@@ -16,7 +16,7 @@ unless Time::new.respond_to?( :strftime_jroku_backup ) then
class Time
alias strftime_jroku_backup strftime
JROKU = %w(大安 赤口 先勝 友引 先負 仏滅)
-
+
def strftime( format )
d=Gregorian.new(self.month, self.day, self.year)
q_d = Calendar.kyureki_from_absolute(d.abs)
diff --git a/plugin/jyear.rb b/plugin/jyear.rb
index 19fa402..ea9439c 100644
--- a/plugin/jyear.rb
+++ b/plugin/jyear.rb
@@ -1,10 +1,10 @@
# jyear.rb $Revision: 1.1 $
-#
+#
# 西暦を和暦に変換するプラグイン。
# 日記やツッコミの日付フォーマットで使う。
# 「%Y」で「2005」のところを、「%K」で「平成17」と表示。
# pluginに入れるだけで動作する。
-#
+#
# Copyright (c) 2005 sasasin/SuzukiShinnosuke<sasasin at sasasin.sytes.net>
# You can distribute this file under the GPL.
#
diff --git a/plugin/makerss_category.rb b/plugin/makerss_category.rb
index e9790b0..88d77de 100644
--- a/plugin/makerss_category.rb
+++ b/plugin/makerss_category.rb
@@ -12,7 +12,7 @@ class MakeRssCategory < MakeRssFull
def title
'(category only)'
end
-
+
def item( seq, body, rdfsec )
return unless rdfsec.section.respond_to?( :body_to_html )
return if rdfsec.section.categories.length == 0
@@ -22,17 +22,17 @@ class MakeRssCategory < MakeRssFull
end
end
end
-
+
def file
f = @conf['makerss.category.file'] || 'category.rdf'
f = 'category.rdf' if f.length == 0
f =~ %r|^/| ? f : "#{document_root}/#{f}"
end
-
+
def write( encoder )
super( encoder )
end
-
+
def url
u = @conf['makerss.category.url'] || "#{@conf.base_url}category.rdf"
u = "#{@conf.base_url}category.rdf" if u.length == 0
diff --git a/plugin/makerss_comment.rb b/plugin/makerss_comment.rb
index 54ebc65..467a6c2 100644
--- a/plugin/makerss_comment.rb
+++ b/plugin/makerss_comment.rb
@@ -9,22 +9,22 @@ class MakeRssComments < MakeRssFull
def title
'(comments only)'
end
-
+
def item( seq, body, rdfsec )
return if rdfsec.section.respond_to?( :body_to_html )
super
end
-
+
def file
f = @conf['makerss.no_comments.file'] || 'comments.rdf'
f = 'comments.rdf' if f.length == 0
f =~ %r|^/| ? f : "#{document_root}/#{f}"
end
-
+
def write( encoder )
super( encoder )
end
-
+
def url
u = @conf['makerss.no_comments.url'] || "#{@conf.base_url}comments.rdf"
u = "#{@conf.base_url}comments.rdf" if u.length == 0
diff --git a/plugin/microsummary.rb b/plugin/microsummary.rb
index a171508..63c213c 100644
--- a/plugin/microsummary.rb
+++ b/plugin/microsummary.rb
@@ -6,7 +6,7 @@
add_header_proc do
generator_xml = @conf['generator.xml']
-
+
if generator_xml != nil and @mode == 'latest' and !@cgi.valid?( 'date' )
%Q|\t<link rel="microsummary" href="#{generator_xml}" type="application/x.microsummary+xml">\n|
end
@@ -41,7 +41,7 @@ def create_xml file_name
</pages>
</generator>
XML
-
+
begin
File::open( file_name, 'w' ) do |f|
f.print to_utf8( xml )
diff --git a/plugin/nhk_program_info.rb b/plugin/nhk_program_info.rb
index 0c05eb4..e46ad36 100644
--- a/plugin/nhk_program_info.rb
+++ b/plugin/nhk_program_info.rb
@@ -42,7 +42,7 @@ def nhk_program_info(id, service, area = nil)
</a>
</div>
PROGRAM_HTML
-
+
end
def call_nhk_json(id, service, area)
@@ -81,7 +81,7 @@ add_conf_proc( 'nhk', 'NHK API' ) do
@conf['nhk_api.id'] = @cgi.params['nhk_api.id'][0]
@conf['nhk_api.default.area'] = @cgi.params['nhk_api.default.area'][0]
end
-
+
<<-HTML
<h3 class="subtitle">API key</h3>
<p><input name="nhk_api.id" value="#{h @conf['nhk_api.id']}" size="70"></p>
diff --git a/plugin/picasa.rb b/plugin/picasa.rb
index dbd1956..399330d 100644
--- a/plugin/picasa.rb
+++ b/plugin/picasa.rb
@@ -20,7 +20,7 @@
def picasa( src, alt = "photo", place = 'photo' )
src.sub!( %r|/s\d+/|, "/s200/" ) if @conf.iphone?
-
+
if @cgi.mobile_agent?
body = %Q|<a href="#{src}">#{alt}</a>|
else
@@ -45,7 +45,7 @@ if /\A(form|edit|preview|showcomment)\z/ === @mode then
end
add_edit_proc do |date|
- unless @conf['picasa.user']
+ unless @conf['picasa.user']
'<p>[ERROR] picasa.rb: Picasa username is not specified.</p>'
else
<<-HTML
diff --git a/plugin/playstore.rb b/plugin/playstore.rb
index 32a35a1..ed0256b 100644
--- a/plugin/playstore.rb
+++ b/plugin/playstore.rb
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# playstore.rb
-#
+# playstore.rb
+#
# 概要:
# GooglePlay(play.google.com)へのリンクを生成します。
#
@@ -67,7 +67,7 @@ def playstore_save_cache(app)
path="#{@cache_path}/playstore/#{app.app_id}"
dir = File.dirname(path)
Dir.mkdir(dir) unless File.directory?(dir)
-
+
app.save(path)
end
diff --git a/plugin/rating.rb b/plugin/rating.rb
index a2e5536..b0c18ea 100644
--- a/plugin/rating.rb
+++ b/plugin/rating.rb
@@ -6,7 +6,7 @@
# ���Τޤ� plugin �ǥ��쥯�ȥ���֤��ޤ���
# '����' -> 'rating.rb Configuration' �ǡ�ɾ������
# ɽ�����Ƥ����ꡣ
-# ���路����
+# ���路����
# http://www.maripo.jp/diary/?date=20071019
#
# Copyright (c) 2007 Mariko/Maripo GODA <god at maripo.jp>
@@ -90,9 +90,9 @@ HTML
<tr>
<td>�ɲ�</td>
<td>
-����̾��:<input type="text" size="16" name="label_new">
-�����٥�:<input type="text" size="10" name="label_min_new">
-�ǹ��٥�:<input type="text" size="10" name="label_max_new">
+����̾��:<input type="text" size="16" name="label_new">
+�����٥�:<input type="text" size="10" name="label_min_new">
+�ǹ��٥�:<input type="text" size="10" name="label_max_new">
������:<input type="text" size="4" name="range_new">
</td>
</tr>
@@ -133,13 +133,13 @@ HTML
form_string += ('<form action="./"><input type="hidden" name="comment" value="submit"><input type="hidden" name="body" value="rating"><input type="hidden" name="body" value="rating"><input type="hidden" name="name" value=""><input type="hidden" value="' + date.strftime('%Y%m%d') + '"><div class="ratingForm">')
@rating_config.each{|axis_config|
- if !axis_config.display
+ if !axis_config.display
next
end
# add axis info
form_string += ('<div class="ratingQuestion"><span class="ratingLabel">' + axis_config.label + '</span>')
-
+
# add radio buttons
form_string += ('<span class="ratingRadioButtons"><span class="ratingLabelMin">' + axis_config.label_min + '</span>')
@@ -253,7 +253,7 @@ class AxisConfig
@id
@order
@display = true
-
+
#accessors
attr_reader :label, :label_max, :label_min, :range, :id, :order, :display
@@ -287,11 +287,11 @@ class AxisConfig
def enable
@hidden = false
end #end disable
-
+
def check_label
return @display? "checked":""
end #end check_label
-
+
end
#########################################
@@ -357,7 +357,7 @@ class DateEval
def vote(id, rank)
unless @axes.key?(id)
- @axes[id] = Array.new
+ @axes[id] = Array.new
end
if @axes[id][rank] != nil
@axes[id][rank] += 1
diff --git a/plugin/recent_estraier.rb b/plugin/recent_estraier.rb
index 8461344..4250cca 100644
--- a/plugin/recent_estraier.rb
+++ b/plugin/recent_estraier.rb
@@ -4,10 +4,10 @@
# estsearch.cgiが作成する検索キーワードログから
# 最新xx件分の検索語を表示します。
# パラメタ:
-# file: 検索キーワードログファイル名(絶対パス表記)
-# estraier: estseach.cgiのパス
-# limit: 表示件数(未指定時:5)
-# make_link: <a>を生成するか?(未指定時:生成する)
+# file: 検索キーワードログファイル名(絶対パス表記)
+# estraier: estseach.cgiのパス
+# limit: 表示件数(未指定時:5)
+# make_link: <a>を生成するか?(未指定時:生成する)
#
#
# Copyright (c) 2005 SHIBATA Hiroshi <h-sbt at nifty.com>
@@ -26,7 +26,7 @@ def recent_estraier(file, estraier, limit = 5, make_link = true)
log.each_line do |line|
lines << line
end
-
+
result = "<ol>"
lines.reverse.each_with_index do |line,idx|
break if idx >= limit
@@ -41,9 +41,9 @@ def recent_estraier(file, estraier, limit = 5, make_link = true)
end
end
end
-
+
result << %Q[</ol>]
-
+
rescue
%Q[<p class="message">#$! (#{$!.class})<br>cannot read #{file}.</p>]
end
diff --git a/plugin/search-bing.rb b/plugin/search-bing.rb
index a704944..707c101 100644
--- a/plugin/search-bing.rb
+++ b/plugin/search-bing.rb
@@ -82,7 +82,7 @@ def search_result
r << %Q|<dd>#{search_to_html desc}</dd>|
end
r << '</dl>'
-
+
r << '<div class="search-navi">'
# no search navi on Bing search because no total result not supported
r << '</div>'
diff --git a/plugin/search-google-custom.rb b/plugin/search-google-custom.rb
index d59a294..3bc616c 100644
--- a/plugin/search-google-custom.rb
+++ b/plugin/search-google-custom.rb
@@ -44,7 +44,7 @@ end
def search_result
w = @conf["search-google-custom.width"] || 600
h = @conf["search-google-custom.height"] || 1300
-
+
r = <<-HTML
<div id="cse-search-results"></div>
<script type="text/javascript">
diff --git a/plugin/search-yahoo-websearch.rb b/plugin/search-yahoo-websearch.rb
index 0b952ec..45b4937 100644
--- a/plugin/search-yahoo-websearch.rb
+++ b/plugin/search-yahoo-websearch.rb
@@ -41,12 +41,12 @@ def yahoo_websearch_api( q, start = 1 )
url = request_url
appid = @conf['search-yahoo-websearch.appid']
uri = URI::parse( @conf.base_url )
-
+
url << "?appid=#{appid}&query=#{q}&results=20&start=#{start}&format=html&site=#{uri.host}"
proxy = @conf['proxy']
proxy = 'http://' + proxy if proxy
-
+
proxy_host, proxy_port = nil
if proxy
proxy_host = proxy_uri.host
@@ -77,7 +77,7 @@ end
def search_result
query = CGI::unescape( @cgi.params['q'][0] )
start = CGI::unescape( @cgi.params['start'][0] || '1' ).to_i
-
+
begin
uri = URI::parse( @conf.base_url )
xml = yahoo_websearch_api( u( query.untaint ), start )
@@ -89,7 +89,7 @@ def search_result
rescue OpenURI::HTTPError
return %Q|<p class="message">#$!</p>|
end
-
+
r = '<dl class="search-result autopagerize_page_element">'
doc.elements.to_a( 'Result' ).each do |elem|
url = elem.elements.to_a( 'Url' )[0].text
@@ -100,13 +100,13 @@ def search_result
r << %Q|<dd>#{search_to_html summary}</dd>|
end
r << '</dl>'
-
+
r << '<div class="search-navi">'
pos = doc.elements["/ResultSet"].attributes["firstResultPosition"]
unless pos == '1'
r << %Q|<a href="#{@conf.index}?q=#{u query}&start=#{pos.to_i - 20}" rel="prev"><前の20件</a> |
end
-
+
total = doc.elements["/ResultSet"].attributes["totalResultsAvailable"]
ret = doc.elements["/ResultSet"].attributes["totalResultsReturned"]
@@ -114,8 +114,8 @@ def search_result
r << %Q|<a href="#{@conf.index}?q=#{u query}&start=#{pos.to_i + 20}" rel="next">次の20件></a>|
end
r << '</div>'
-
+
r << yahoo_websearch_attribution
-
+
r
end
diff --git a/plugin/search-yahoo.rb b/plugin/search-yahoo.rb
index 8931c33..6303ce3 100644
--- a/plugin/search-yahoo.rb
+++ b/plugin/search-yahoo.rb
@@ -38,7 +38,7 @@ def search_boss_api( q, start = 0 )
proxy = @conf['proxy']
proxy = 'http://' + proxy if proxy
-
+
proxy_host, proxy_port = nil
if proxy
proxy_host = proxy_uri.host
diff --git a/plugin/section_footer2.rb b/plugin/section_footer2.rb
index fb58ad2..38e9e8e 100644
--- a/plugin/section_footer2.rb
+++ b/plugin/section_footer2.rb
@@ -186,7 +186,7 @@ def add_twitter(date, index)
data-url="#{permalink(date, index, false).gsub(/#.*$/, '')}"
data-text="#{CGI.escapeHTML(subtitle(date, index))}"
data-via="#{@conf['twitter.user']}"
- >tweet</a> |
+ >tweet</a> |
EOS
end
diff --git a/plugin/show_and_hide.rb b/plugin/show_and_hide.rb
index 8c09d52..a78ba1c 100644
--- a/plugin/show_and_hide.rb
+++ b/plugin/show_and_hide.rb
@@ -10,63 +10,63 @@ require 'digest/md5'
if /\A(?:latest|day|month|nyear|preview)\z/ =~ @mode
enable_js('show_and_hide.js')
-
+
end
-def show_and_hide(contents, title = 'Show contents',
+def show_and_hide(contents, title = 'Show contents',
type = :link,
rss_title = '(Hide contents on RSS. See my page...)')
-
+
data_id = show_and_hide_id(contents)
-
+
toggle_attr = {:class => 'show_and_hide_toggle',
:"data-showandhideid" => data_id}
-
+
dom_contents = ''
-
+
if feed? # RSS
dom_contents = h(rss_title)
-
+
elsif type.to_s == 'button'
toggle_attr.merge!(:value => title, :type => "button")
- dom_contents = %Q|<input #{hash2attr(toggle_attr)}>| +
+ dom_contents = %Q|<input #{hash2attr(toggle_attr)}>| +
show_and_hide_contents(contents, data_id)
-
+
else
toggle_attr.merge!(:href => 'javascript:void(0)')
- dom_contents = %Q|<a #{hash2attr(toggle_attr)}>#{h(title)}</a>| +
+ dom_contents = %Q|<a #{hash2attr(toggle_attr)}>#{h(title)}</a>| +
show_and_hide_contents(contents, data_id)
-
+
end
-
+
dom_contents
-
+
end
def show_and_hide_id(contents)
@@show_and_hide_counter ||= 0
@@show_and_hide_counter += 1
-
+
"#{Time::now.strftime("%s")}_#{@@show_and_hide_counter}_#{ Digest::MD5.hexdigest(contents)}"
-
+
end
def show_and_hide_contents(contents, id)
%Q|<pre class="show_and_hide" id="#{id}">#{h(contents)}</pre>|
-
+
end
def hash2attr(hash)
attrs = []
-
+
hash.keys.each do |k|
attrs << %Q|#{k}="#{hash[k]}"|
end
-
+
attrs.join(" ")
-
+
end
-
+
# Local Variables:
# mode: ruby
# indent-tabs-mode: t
diff --git a/plugin/socialbutton.rb b/plugin/socialbutton.rb
index fbdcd22..6d1f42f 100644
--- a/plugin/socialbutton.rb
+++ b/plugin/socialbutton.rb
@@ -6,7 +6,7 @@
# enable social button names
@conf['socialbutton.enables'] ||= 'twitter,hatena,facebook_like'
-# screen name of the user to attribute the tweet to
+# screen name of the user to attribute the tweet to
@conf['socialbutton.twitter.via'] ||= ''
def socialbutton_js_settings
@@ -14,7 +14,7 @@ def socialbutton_js_settings
enable_js('socialbutton.js')
add_js_setting('$tDiary.plugin.socialbutton')
# convert array to json
- add_js_setting('$tDiary.plugin.socialbutton.enables',
+ add_js_setting('$tDiary.plugin.socialbutton.enables',
%Q|["#{@conf['socialbutton.enables'].split(',').join('", "')}"]|)
if @conf['socialbutton.twitter.via'] != ''
diff --git a/plugin/tdiarytimes.rb b/plugin/tdiarytimes.rb
index 5c2b99c..1fe31be 100644
--- a/plugin/tdiarytimes.rb
+++ b/plugin/tdiarytimes.rb
@@ -15,7 +15,7 @@
# サーバが書き込み権限を持っているファイルを作ります。
# これで日記に書き込みするごとに、tdiarytimes.pngに
# 画像を書き込みます。
-#
+#
# 日記上からこのpngファイルを呼び出すには、
# tDiray上からプラグインとして
# <%=tdiarytimes%>
@@ -25,30 +25,30 @@
#
# また、tdiary.confに以下のオプションを書き込むことにより、
# カスタマイズをすることが出来ます。
-#
+#
# @options['tdiarytimes.width'] = 400
# 四角の横幅。デフォルト値400。
# 実際に出力される画像サイズは、これに+10したサイズ。
-#
+#
# @options['tdiarytimes.height'] = 20
# 四角の縦幅。デフォルト値20。
# 実際に出力される画像サイズは、これに+16したサイズ。
-#
+#
# @options['tdiarytimes.file'] = 'tdiarytimes.png'
# 出力する画像ファイル名。デフォルトは'tdiarytimes.png'
-#
+#
# @options['tdiarytimes.fillcolor'] = '#444444'
# 四角の色。デフォルトは'#444444'
-#
+#
# @options['tdiarytimes.linecolor'] = '#ffffff'
# 縦棒の色。デフォルトは'#ffffff'
-#
+#
# @options['tdiarytimes.textcolor'] = '#444444'
# 文字色。デフォルトは'#444444'
-#
+#
# @options['tdiarytimes.text'] = 'T D I A R Y T I M E S'
# 出力する文字。デフォルトは'T D I A R Y T I M E S'。なお半角英数字のみ対応。
-#
+#
# @options['tdiarytimes.day'] = 30
# ログを保存する最大日数。デフォルトは30。
# この場合、30日以上経ったデータは消去され、縦棒として描画されなくなる。
@@ -66,8 +66,8 @@ if /^(append|replace)$/ =~ @mode then
linecolor = @options['tdiarytimes.linecolor'] || '#ffffff'
textcolor = @options['tdiarytimes.textcolor'] || '#444444'
text = @options['tdiarytimes.text'] || 'T D I A R Y T I M E S'
- day = @options['tdiarytimes.day'] || 30
-
+ day = @options['tdiarytimes.day'] || 30
+
cache = "#{@cache_path}/tdiarytimes"
Dir::mkdir( cache ) unless File::directory?( cache )
@@ -78,7 +78,7 @@ if /^(append|replace)$/ =~ @mode then
fillcolor = image.colorAllocate(fillcolor)
linecolor = image.colorAllocate(linecolor)
textcolor = image.colorAllocate(textcolor)
-
+
#帯の描画
image.filledRectangle(5,8,width + 4,height + 7,fillcolor)
@@ -140,21 +140,21 @@ if /^(append|replace)$/ =~ @mode then
pngfile = open(file, 'w')
image.png(pngfile)
pngfile.close
-
+
end
def tdiarytimes(alt = nil)
width = @options['tdiarytimes.width'].to_i || 400
width += 10
-
+
height = @options['tdiarytimes.height'].to_i || 20
height += 16
-
+
file = @options['tdiarytimes.file'] || 'tdiarytimes.png'
text = @options['tdiarytimes.text'] || 'T D I A R Y T I M E S'
result = ""
-
+
if alt
result << %Q|<img src="#{h file}" alt="#{h alt}" width="#{width}" height="#{height}" class="tdiarytimes">|
else
diff --git a/plugin/tdiarytimes2.rb b/plugin/tdiarytimes2.rb
index 5b09d70..9a6114f 100644
--- a/plugin/tdiarytimes2.rb
+++ b/plugin/tdiarytimes2.rb
@@ -18,7 +18,7 @@
# サーバが書き込み権限を持っているファイルを作ります。
# これで日記に書き込みするごとに、tdiarytimes.pngに
# 画像を書き込みます。
-#
+#
# 日記上からこのpngファイルを呼び出すには、
# tDiray上からプラグインとして
# <%=tdiarytimes%>
@@ -28,27 +28,27 @@
#
# また、tdiary.confに以下のオプションを書き込むことにより、
# カスタマイズをすることが出来ます。
-#
+#
# @options['tdiarytimes.width'] = 400
# 四角の横幅。デフォルト値400。
# 実際に出力される画像サイズは、これに+10したサイズ。
-#
+#
# @options['tdiarytimes.height'] = 20
# 四角の縦幅。デフォルト値20。
# 実際に出力される画像サイズは、これに+16したサイズ。
-#
+#
# @options['tdiarytimes.file'] = 'tdiarytimes.png'
# 出力する画像ファイル名。デフォルトは'tdiarytimes.png'
-#
+#
# @options['tdiarytimes.fillcolor'] = '#444444'
# 四角の色。デフォルトは'#444444'
-#
+#
# @options['tdiarytimes.linecolor'] = '#ffffff'
# 縦棒の色。デフォルトは'#ffffff'
-#
+#
# @options['tdiarytimes.textcolor'] = '#444444'
# 文字色。デフォルトは'#444444'
-#
+#
# @options['tdiarytimes.fadeout'] = false
# フェードアウトするか。デフォルトはfalse。
# フェードアウトしたいときには true にすればよい。
@@ -58,10 +58,10 @@
# デフォルトではfillcolorへとフェードアウトしていく。
# ここで色を指定するとその色へとフェードアウトしていく。
# デフォルトは false
-#
+#
# @options['tdiarytimes.text'] = 'T D I A R Y T I M E S'
# 出力する文字。デフォルトは'T D I A R Y T I M E S'。なお半角英数字のみ対応。
-#
+#
# @options['tdiarytimes.day'] = 30
# ログを保存する最大日数。デフォルトは30。
# この場合、30日以上経ったデータは消去され、縦棒として描画されなくなる。
diff --git a/plugin/tdiarytimes_textstyle.rb b/plugin/tdiarytimes_textstyle.rb
index f873ace..d1c94c7 100644
--- a/plugin/tdiarytimes_textstyle.rb
+++ b/plugin/tdiarytimes_textstyle.rb
@@ -47,7 +47,7 @@
#
# オプション値の設定方法には3つの方法があり、その優先順位は次の通りです。
# <%= tdiarytimes_textstyle %> 引数指定 > tdiary.conf設定値 > デフォルト値
-#
+#
# entr_intervalを除いた全てのオプション値は <%= %> への引数指定により設定出来るため、
# ページにごとに意匠を変更するなど自由度の高いサイトデザインが可能です。
# 一方で、全てのオプションにデフォルト値が用意されているため、
@@ -60,7 +60,7 @@
#【書式】
# <%= tdiarytimes_textstyle init_text, entr_text, init_color, entr_color, fade_color, init_css, entr_css, title_text, fade_time %>
#
-#【記述例】
+#【記述例】
# <%=tdiarytimes_textstyle "●","●","004400","66ff66","004400","background-color:#002200;font-size:9px",nil,"TEXTSTYLE!!",15 %>
#
# ※ tdiary.conf指定値、またはデフォルト値を使用したい場合は、引数に nil を指定してください。
@@ -193,7 +193,7 @@ if /^(append|replace)$/ =~ @mode then
if (Time.now.to_i - ary_data[144]) > entr_interval.to_f
ary_data[(Time.now.strftime('%H').to_i*6 + Time.now.strftime('%M').to_f/10).to_i] = Time.now.to_i
# 最終登録時間の記録
- ary_data[144] = Time.now.to_i
+ ary_data[144] = Time.now.to_i
end
diff --git a/plugin/twitter_anywhere.rb b/plugin/twitter_anywhere.rb
index 6e24f09..b5f85b5 100644
--- a/plugin/twitter_anywhere.rb
+++ b/plugin/twitter_anywhere.rb
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# twitter_anywhere.rb - bringing the Twitter communication platform to tDiary
-# refer to the URL below.
+# refer to the URL below.
# https://dev.twitter.com/docs/anywhere/welcome
#
# Copyright (C) 2010-2012, tamoot <tamoot+tdiary at gmail.com>
@@ -11,12 +11,12 @@
def follow_button(account)
return not_support_anywhere unless support_anywhere?
return not_ready_anywhere unless ready_anywhere?
-
+
if account.nil? || account == ''
return anywhere_plugin_error("Account name is not specified.")
-
+
end
-
+
<<-FOLLOW_API
<span id="follow-twitterapi"></span>
<script type="text/javascript">
@@ -25,96 +25,96 @@ def follow_button(account)
});
</script>
FOLLOW_API
-
+
end
def tweet_box(label = nil, content = nil, option = {})
return not_support_anywhere unless support_anywhere?
return not_ready_anywhere unless ready_anywhere?
init_tweetbox
-
+
@tweetbox_opt.merge!(option)
@tweetbox_opt.merge!(:height => 120) unless option[:height].to_i > 0
@tweetbox_opt.merge!(:width => 480) unless option[:width].to_i > 0
-
+
@tweetbox_opt.merge!(:label => label) if label
@tweetbox_opt.merge!(:defaultContent => content) if content
-
+
%Q|<span id="tweetbox"></span>|
-
+
end
def twitter_anywhere_settings
enable_js('twitter_anywhere.js')
add_js_setting('$tDiary.plugin.twitter_anywhere')
-
+
selectors = @conf['twitter_anywhere.hovercards.selectors'].split(',').collect do |selector|
%Q|"#{selector.strip}"|
end
add_js_setting('$tDiary.plugin.twitter_anywhere.selectors',
"[#{selectors.join(',')}]" )
-
+
expanded = '{}'
if @conf['twitter_anywhere.hovercards.expand_default'] == 'true'
expanded = '{"expanded":true}'
-
+
end
add_js_setting('$tDiary.plugin.twitter_anywhere.hovercards')
add_js_setting('$tDiary.plugin.twitter_anywhere.hovercards.expand_default',
expanded)
-
+
end
-add_header_proc do
+add_header_proc do
if /\A(?:latest|day|month|nyear|preview)\z/ =~ @mode
-
+
if ready_anywhere?
%Q|<script src="http://platform.twitter.com/anywhere.js?id=#{h @conf['twitter_anywhere.id']}&v=1"></script>|
-
+
else
''
-
+
end
-
+
end
-
+
end
def init_tweetbox
@tweetbox_json_opt ||= []
@tweetbox_opt ||= {}
-
+
end
add_footer_proc do |date|
-
+
if /\A(?:latest|day|month|nyear|preview)\z/ =~ @mode
-
+
if ready_anywhere?
-
+
init_tweetbox
-
+
@tweetbox_opt.each_pair do |k, v|
@tweetbox_json_opt << "\"#{k}\":\"#{v}\""
-
+
end
-
+
tweet_box_call = %Q|<script type="text/javascript">\n|
tweet_box_call << %Q|<!--\n|
tweet_box_call << %Q| showTweetBox({#{@tweetbox_json_opt.join(',')}});\n|
tweet_box_call << %Q|//-->\n|
tweet_box_call << %Q|</script>\n|
-
+
else
''
-
+
end
-
+
else
''
-
+
end
end
@@ -122,68 +122,68 @@ add_conf_proc( 'twitter_anywhere', 'Twitter Anywhere' ) do
if @mode == 'saveconf' then
@conf['twitter_anywhere.id'] = @cgi.params['twitter_anywhere.id'][0]
@conf['twitter_anywhere.hovercards.selectors'] = @cgi.params['twitter_anywhere.hovercards.selectors'][0]
- @conf['twitter_anywhere.hovercards.expand_default'] = @cgi.params['twitter_anywhere.hovercards.expand_default'][0]
-
+ @conf['twitter_anywhere.hovercards.expand_default'] = @cgi.params['twitter_anywhere.hovercards.expand_default'][0]
+
end
-
+
expand_true = ""
expand_false = "selected"
-
+
if @conf['twitter_anywhere.hovercards.expand_default'] == "true"
expand_true = "selected"
expand_false = ""
-
+
end
-
+
<<-HTML
<h3 class="subtitle">Consumer key</h3>
-
+
<p><input name="twitter_anywhere.id" value="#{h @conf['twitter_anywhere.id']}" size="70"></p>
- <p>Register your tDiary and get Consumer key.
+ <p>Register your tDiary and get Consumer key.
<a href="http://dev.twitter.com/anywhere">Go Twitter OAuth settings.</a></p>
-
+
<h3 class="subtitle">Rending Hovercards</h3>
-
+
<h4>CSS Selector To limit the scope of where Hovercards appear</h4>
<p><input name="twitter_anywhere.hovercards.selectors" value="#{h @conf['twitter_anywhere.hovercards.selectors']}" size="70"></p>
<p>example) div.section p, div.commentshort p, div.commentbody p</p>
-
+
<h4>Expanded by Default</h4>
<p><select name="twitter_anywhere.hovercards.expand_default">
<option value="true" #{expand_true}>true</option>
<option value="false" #{expand_false}>false</option>
</select></p>
HTML
-
+
end
def support_anywhere?
return false if @conf.mobile_agent? || feed?
return true
-
+
end
def ready_anywhere?
- if @conf['twitter_anywhere.id'] && @conf['twitter_anywhere.id'].size > 0
+ if @conf['twitter_anywhere.id'] && @conf['twitter_anywhere.id'].size > 0
return true
-
+
end
-
+
return false
-
+
end
def not_support_anywhere
- '[Twitter at Anywhere] not support this environment.'
-
+ '[Twitter at Anywhere] not support this environment.'
+
end
def not_ready_anywhere
anywhere_plugin_error(
"Twitter consumer Key not specified.",
%Q|<a href="http://dev.twitter.com/anywhere">Go Twitter OAuth settings.</a>|)
-
+
end
def anywhere_plugin_error(message, detail= '')
@@ -193,7 +193,7 @@ def anywhere_plugin_error(message, detail= '')
<p>#{detail}</p>
</div>
PLUGIN_ERROR
-
+
end
if /\A(?:latest|day|month|nyear|preview)\z/ =~ @mode
diff --git a/plugin/twitter_summary_card.rb b/plugin/twitter_summary_card.rb
index f4eb48e..b5dd6fc 100644
--- a/plugin/twitter_summary_card.rb
+++ b/plugin/twitter_summary_card.rb
@@ -41,7 +41,7 @@ add_conf_proc('Twitter Summary Card', 'Twitter Summary Card') do
<<-HTML
<h2>Twitter Summary Card</h2>
<p>
- Please refer to the following documentation at first.
+ Please refer to the following documentation at first.
<ul>
<li><a href="https://dev.twitter.com/docs/cards/types/summary-card" target="_blank">Summary Card | Twitter Developers</a></li>
</ul>
diff --git a/plugin/vote.rb b/plugin/vote.rb
index 5e7db9e..1dc00e1 100644
--- a/plugin/vote.rb
+++ b/plugin/vote.rb
@@ -3,8 +3,8 @@
# You can redistribute it and/or modify it under GPL2.
#
# ref. http://elpeo.jp/diary/20060622.html#p01
-#
-# .tdiary-vote {
+#
+# .tdiary-vote {
# float: left;
# background-color: aqua;
# }
@@ -53,7 +53,7 @@ def get_vote( date, uid )
voted = db['voter'].include?( uid ) if db.root?( 'voter' )
db.abort
end
- end
+ end
[h, voted]
end
@@ -81,7 +81,7 @@ end
unless bot? then
if @mode == 'comment' && @cgi.valid?( 'vote' ) && @cgi.cookies['tdiary_vote'][0] then
- add_vote( @date, @cgi.params['vote'][0], @cgi.cookies['tdiary_vote'][0] )
+ add_vote( @date, @cgi.params['vote'][0], @cgi.cookies['tdiary_vote'][0] )
end
add_footer_proc do
diff --git a/plugin/yahoo_kousei.rb b/plugin/yahoo_kousei.rb
index db22cba..32204a6 100644
--- a/plugin/yahoo_kousei.rb
+++ b/plugin/yahoo_kousei.rb
@@ -1,5 +1,5 @@
#
-# yahoo_kousei.rb -
+# yahoo_kousei.rb -
# Yahoo!JAPANデベロッパーネットワークの校正支援APIを利用して、
# 日本語文の校正作業を支援します。文字の入力ミスや言葉の誤用がないか、
# わかりにくい表記や不適切な表現が使われていないかなどをチェックします。
@@ -32,7 +32,7 @@ def kousei_api( sentence )
px_host, px_port = (@conf['proxy'] || '').split( /:/ )
px_port = 80 if px_host and !px_port
-
+
xml = ''
Net::HTTP::Proxy( px_host, px_port ).start( 'jlp.yahooapis.jp' ) do |http|
xml = http.post( '/KouseiService/V1/kousei', query ).body
diff --git a/plugin/yo_update.rb b/plugin/yo_update.rb
new file mode 100644
index 0000000..04d3f4c
--- /dev/null
+++ b/plugin/yo_update.rb
@@ -0,0 +1,214 @@
+# -*- coding: utf-8 -*-
+#
+# yo_update.rb - Yo all when an entry or a comment is posted
+#
+# Copyright (C) 2014, zunda <zundan at gmail.com>
+#
+# Permission is granted for use, copying, modification,
+# distribution, and distribution of modified versions of this
+# work under the terms of GPL version 2 or later.
+#
+
+require 'uri'
+require 'timeout'
+require 'net/http'
+require 'json'
+
+YO_UPDATE_TIMEOUT = 10
+
+class YoUpdateError < StandardError; end
+
+def yo_update_api_key
+ r = @conf['yo_update.api_key']
+ if not r or r.empty?
+ return nil
+ end
+ return r
+end
+
+def yo_update_access_api(req)
+ if @conf['proxy']
+ proxy_uri = URI("http://" + @conf['proxy'])
+ proxy_addr = proxy_uri.host
+ proxy_port = proxy_uri.port
+ else
+ proxy_addr = nil
+ proxy_port = nil
+ end
+ begin
+ timeout(YO_UPDATE_TIMEOUT) do
+ return Net::HTTP.start(req.uri.host, req.uri.port, proxy_addr, proxt_port){|http|
+ http.request(req)
+ }
+ end
+ rescue Timeout::Error
+ raise YoUpdateError, "Timeout accessing Yo API"
+ rescue SocketError => e
+ raise YoUpdateError, e.message
+ end
+end
+
+def yo_update_send_yo(username = nil)
+ api_key = yo_update_api_key
+ unless api_key
+ raise YoUpdateError, "Yo API Key is not set"
+ end
+ unless username
+ req = Net::HTTP::Post.new(URI("http://api.justyo.co/yoall/"))
+ req.set_form_data('api_token' => yo_update_api_key)
+ expected = '{}'
+ else
+ req = Net::HTTP::Post.new(URI("http://api.justyo.co/yo/"))
+ req.set_form_data('api_token' => yo_update_api_key, 'username' => username)
+ expected = '{"result": "OK"}'
+ end
+ res = yo_update_access_api(req)
+ data = res.body
+ unless data == expected
+ raise YoUpdateError, "error from Yo API: #{data}"
+ end
+ return data
+end
+
+def yo_update_send_yo_or_log(username = nil)
+ return unless yo_update_api_key
+ begin
+ yo_update_send_yo(username)
+ rescue YoUpdateError => e
+ @logger.error "yo_update.rb: #{e.message}"
+ end
+end
+
+def yo_update_subscribers_count
+ api_key = yo_update_api_key
+ unless api_key
+ raise YoUpdateError, "Yo API Key is not set"
+ end
+ req = Net::HTTP::Get.new(
+ URI("http://api.justyo.co/subscribers_count/?api_token=#{URI.escape(api_key)}")
+ )
+ res = yo_update_access_api(req)
+ data = res.body
+ begin
+ r = JSON::parse(data)
+ if r.has_key?('result')
+ return r['result']
+ else
+ raise YoUpdateError, "Error from Yo API: #{data}"
+ end
+ rescue JSON::ParserError
+ raise YoUpdateError, "Error from Yo API: #{data}"
+ end
+end
+
+unless defined? yo_update_conf_label # maybe defined in a language resource
+ def yo_update_conf_label
+ 'Send Yo with updates'
+ end
+end
+
+unless defined? yo_update_test_result_label # maybe defined in a language resource
+ def yo_update_test_result_label(username, result)
+ "- Sent to <tt>#{h username}</tt> and got <tt>#{h result}</tt>"
+ end
+end
+
+unless defined? yo_update_conf_html # maybe defined in a language resource
+ def yo_update_conf_html(conf, n_subscribers, test_result)
+ action_label = {
+ 'send_on_update' => 'when an entry is added',
+ 'send_on_comment' => 'when a comment is posted',
+ }
+ <<-HTML
+ <h3 class="subtitle">API key</h3>
+ <p><input name="yo_update.api_key" value="#{h conf['yo_update.api_key']}" size="40"></p>
+ <h3 class="subtitle">Username</h3>
+ <p><input name="yo_update.username" value="#{h conf['yo_update.username']}" size="40"></p>
+ <h3 class="subtitle">Send Yo</h3>
+ <ul>
+ #{%w(send_on_update send_on_comment).map{|action|
+ checked = conf["yo_update.#{action}"] ? ' checked' : ''
+ %Q|<li><label for="yo_update.#{action}"><input id="yo_update.#{action}" name="yo_update.#{action}" value="t" type="checkbox"#{checked}>#{action_label[action]}</label>|
+ }.join("\n\t")}
+ </ul>
+ <p>Test sending Yo! to <input name="yo_update.test" value="" size="10">#{test_result}</p>
+ <h3 class="subtitle">Current Subscribers</h3>
+ <p>#{h n_subscribers}</p>
+ <h3 class="subtitle">Yo button</h3>
+ <p>Add the following to somewhere or your diary.</p>
+ <pre><div id="yo-button"></div></pre>
+ <h3 class="subtitle">Howto</h3>
+ <ol>
+ <li>Sign in with your personal Yo account at <a href="http://dev.justyo.co/">http://dev.justyo.co/</a>
+ <li>Follow the instructions to obtain new API account.
+ Please leave the Callback URL blank.
+ <li>Copy the API key and API username above.
+ </ol>
+ HTML
+ end
+end
+
+add_conf_proc('yo_update', yo_update_conf_label) do
+ test_result = ''
+ if @mode == 'saveconf' then
+ @conf['yo_update.api_key'] = @cgi.params['yo_update.api_key'][0]
+ @conf['yo_update.username'] = @cgi.params['yo_update.username'][0]
+ @conf['yo_update.send_on_update'] = (@cgi.params['yo_update.send_on_update'][0] == 't')
+ @conf['yo_update.send_on_comment'] = (@cgi.params['yo_update.send_on_comment'][0] == 't')
+ test_username = @cgi.params['yo_update.test'][0]
+ if test_username and not test_username.empty?
+ begin
+ result = yo_update_send_yo(test_username)
+ rescue YoUpdateError => e
+ result = e.message
+ end
+ test_result = yo_update_test_result_label(test_username, result)
+ end
+ end
+ unless @conf.has_key?('yo_update.send_on_update')
+ @conf['yo_update.send_on_update'] = true
+ end
+ begin
+ n_subscribers = yo_update_subscribers_count
+ rescue YoUpdateError => e
+ n_subscribers = e.message
+ end
+ yo_update_conf_html(@conf, n_subscribers, test_result)
+end
+
+add_update_proc do
+ if @mode == 'append' and @conf['yo_update.send_on_update']
+ yo_update_send_yo_or_log
+ elsif @mode == 'comment' and @comment and @comment.visible? and @conf['yo_update.send_on_comment']
+ yo_update_send_yo_or_log
+ end
+end
+
+add_header_proc do
+ if @conf['yo_update.api_key']
+ triggers = []
+ triggers << 'Entry' if @conf['yo_update.send_on_update']
+ triggers << 'Tsukkomi' if @conf['yo_update.send_on_comment']
+ trigger_str = "#{triggers.join(' or ')} is added"
+ <<-HTML
+ <script type="text/javascript"><!--
+ var _yoData = {
+ "username": "#{@conf['yo_update.username']}",
+ "trigger": "#{trigger_str}"
+ };
+ var s = document.createElement("script");
+ s.type = "text/javascript";
+ s.src = "//yoapp.s3.amazonaws.com/js/yo-button.js";
+ (document.head || document.getElementsByTagName("head")[0]).appendChild(s);
+ --></script>
+ HTML
+ end
+end
+
+# Local Variables:
+# mode: ruby
+# indent-tabs-mode: t
+# tab-width: 3
+# ruby-indent-level: 3
+# End:
+# vim: ts=3 sw=3
diff --git a/plugin/zenback.rb b/plugin/zenback.rb
index 132ab58..af48d3c 100644
--- a/plugin/zenback.rb
+++ b/plugin/zenback.rb
@@ -15,12 +15,12 @@ if @mode == 'day' and (respond_to?(:section_mode?) ? section_mode? : true)
end
if defined? add_comment_leave_proc
add_comment_leave_proc do
- "<!-- zenback_body_end -->" +
+ "<!-- zenback_body_end -->" +
insert_zenback
end
else
add_body_leave_proc do
- "<!-- zenback_body_end -->" +
+ "<!-- zenback_body_end -->" +
insert_zenback
end
end
diff --git a/spec/apple_webclip_spec.rb b/spec/apple_webclip_spec.rb
index b17a6c6..69ff86f 100644
--- a/spec/apple_webclip_spec.rb
+++ b/spec/apple_webclip_spec.rb
@@ -13,8 +13,8 @@ describe "apple_webclip plugin" do
plugin = setup_apple_webclip_plugin('http://example.com/example.png')
@header_snippet = plugin.header_proc
end
-
- it "header include url" do
+
+ it "header include url" do
expect(@header_snippet).to eq(%Q|\t<link rel="apple-touch-icon" href="http://example.com/example.png">|)
end
end
@@ -25,8 +25,8 @@ describe "apple_webclip plugin" do
plugin = setup_apple_webclip_plugin('')
@header_snippet = plugin.header_proc
end
-
- it "header is empty" do
+
+ it "header is empty" do
expect(@header_snippet).to be_empty
end
end
@@ -36,8 +36,8 @@ describe "apple_webclip plugin" do
plugin = setup_apple_webclip_plugin(nil)
@header_snippet = plugin.header_proc
end
-
- it "header is empty" do
+
+ it "header is empty" do
expect(@header_snippet).to be_empty
end
end
diff --git a/util/estraier-search/estraier-register.rb b/util/estraier-search/estraier-register.rb
index add1b54..c7f9309 100755
--- a/util/estraier-search/estraier-register.rb
+++ b/util/estraier-search/estraier-register.rb
@@ -186,7 +186,7 @@ module ::TDiary
@db.put_doc(doc)
end
end
-
+
protected
def mode; 'day'; end
@@ -265,7 +265,7 @@ else
conf.hide_comment_form = true
conf.show_nyear = false
def conf.bot?; true; end
-
+
diary = @diaries[@date.strftime('%Y%m%d')]
TDiary::EstraierDB.new(conf).transaction do |estraier_db|
TDiary::EstraierRegister.new(estraier_db, diary).execute(true)
diff --git a/util/image-gallery/image-gallery.rb b/util/image-gallery/image-gallery.rb
index c50c609..ef6b971 100644
--- a/util/image-gallery/image-gallery.rb
+++ b/util/image-gallery/image-gallery.rb
@@ -5,10 +5,10 @@
# Copyright (c) 2005-2013 N.KASHIJUKU <n-kashi[at]whi.m-net.ne.jp>
# You can redistribute it and/or modify it under GPL2.
-if RUBY_VERSION >= '1.9.0'
- Encoding::default_external = 'UTF-8'
- $LOAD_PATH.push('./')
-end
+if RUBY_VERSION >= '1.9.0'
+ Encoding::default_external = 'UTF-8'
+ $LOAD_PATH.push('./')
+end
if FileTest::symlink?( __FILE__ ) then
org_path = File::dirname( File::readlink( __FILE__ ) )
@@ -29,7 +29,7 @@ module TDiary
attr_writer :file, :url, :title, :subtitle, :date, :width, :height, :type
end
-
+
class TDiaryGallery < ::TDiary::TDiaryBase
MAX_PAGES = 20
ORDER_OPTIONS = [
@@ -71,7 +71,7 @@ module TDiary
@width = conf.options['image-gallery.width']
@width = "160" if @width == nil
@vwidth = conf.options['image-gallery.vwidth']
- @vwidth = "640" if @vwidth == nil
+ @vwidth = "640" if @vwidth == nil
@show_exif = conf.options['image-gallery.show_exif']
@show_exif = false if @show_exif == nil
@use_mid_image = conf.options['image-gallery.use_mid_image']
@@ -212,7 +212,7 @@ module TDiary
rescue
end
end
-
+
def format_links(count)
page_count = (count - 1) / @num + 1
current_page = @start / @num + 1
@@ -306,7 +306,7 @@ module TDiary
elsif @page_month != ""
prevmonth = (@page_date << 1).strftime("%Y%m")
nextmonth = (@page_date >> 1).strftime("%Y%m")
- if @name_filter[0] == ?^ and @name_filter[5] == ?/
+ if @name_filter[0] == ?^ and @name_filter[5] == ?/
prevmonth = %Q[^#{prevmonth[0,4]}/#{prevmonth}]
nextmonth = %Q[^#{nextmonth[0,4]}/#{nextmonth}]
elsif @name_filter[0] == ?^
diff --git a/util/image-gallery/misc/plugin/recent_image.rb b/util/image-gallery/misc/plugin/recent_image.rb
index 04eb146..ea77ba4 100644
--- a/util/image-gallery/misc/plugin/recent_image.rb
+++ b/util/image-gallery/misc/plugin/recent_image.rb
@@ -94,7 +94,7 @@ def image_info_rcimg( filename )
data = $'
until data.empty?
- if RUBY_VERSION >= '1.9.0'
+ if RUBY_VERSION >= '1.9.0'
break if data[0].unpack("C").first != 0xFF
break if data[1].unpack("C").first == 0xD9
else
@@ -230,7 +230,7 @@ def init_rcimg
make_image_hash_rcimg
keysort_rcimg
if @recent_image_use_cache
- save_cache_rcimg
+ save_cache_rcimg
end
end
end
@@ -294,7 +294,7 @@ def count_image(name_filter = nil, title_filter = nil)
init_rcimg
if name_filter == nil and title_filter == nil
- count = @recent_image_keys.length
+ count = @recent_image_keys.length
else
@recent_image_keys.each do |key|
image = @recent_image_hash[key]
@@ -350,7 +350,7 @@ end
# Callback Functions
# this is for view_exif().
-add_body_enter_proc(Proc.new do |date|
+add_body_enter_proc(Proc.new do |date|
@image_date_exif = date.strftime("%Y%m%d")
""
end)
diff --git a/util/posttdiary/posttdiary-ex.rb b/util/posttdiary/posttdiary-ex.rb
index 9af962b..b19de35 100755
--- a/util/posttdiary/posttdiary-ex.rb
+++ b/util/posttdiary/posttdiary-ex.rb
@@ -8,7 +8,7 @@
# 2010.10.19: v.1.71: Modified by K.Sakurai (http://ks.nwr.jp)
# Acknowledgements:
# * Based on posttdiary.rb & tdiary.rb by TADA.
-# * Some codes partially imported from Enikki Plugin Ex. :
+# * Some codes partially imported from Enikki Plugin Ex. :
# http://shimoi.s26.xrea.com/hiki/hiki.cgi?TdiaryEnikkiEx
# * Thanks to taketori for image size detection method.
# * Thanks to NOB for debugging.
@@ -124,7 +124,7 @@ def usage( detailed_help )
! ex2. -z 140 (same to 140x140)
! --image-format, -f format string:
! Specify the format string of the image tag
-! These variables can be used in the format string:
+! These variables can be used in the format string:
! $0 : image serial number
! $1 : image url
! $2 : thumbnail image url (when -t is specified)
@@ -420,7 +420,7 @@ end
def add_body_text( prev, sub_head , sub_body )
addtext = prev
- if prev.size > 0 and !(prev =~ /\n$/) then
+ if prev.size > 0 and !(prev =~ /\n$/) then
addtext += "\n"
end
if sub_head =~ %r[^Content-Transfer-Encoding:\s*base64]i then
@@ -630,7 +630,7 @@ def parse_mail( head, body , image_dir )
orglist[imgnum] = orgname
end
end
- elsif head =~ /^Content-Type:\s*text\/plain/i
+ elsif head =~ /^Content-Type:\s*text\/plain/i
textbody = add_body_text( textbody , head, body )
else
raise "posttdiary-ex: can not read this mail (illegal format)"
@@ -912,7 +912,7 @@ begin
user = ARGV.shift.dup
pass = ARGV.shift.dup
end
-
+
require 'base64'
require 'nkf'
require 'net/http'
@@ -921,7 +921,7 @@ begin
mail = NKF::nkf( '-m0 -Xwd', ARGF.read )
raise "posttdiary-ex: no mail text." if not mail or mail.length == 0
-
+
head, body = mail.split( /(?:\r\n){2}|\r\r|\n\n/, 2 )
body = "" unless body
addr, subject, tmpimglist, orglist, @body = parse_mail( head, body, image_dir )
@@ -971,7 +971,7 @@ begin
else
now = tmp
end
-
+
topic_year = now.strftime( "%Y" )
topic_month = now.strftime( "%m" )
topic_date = now.strftime( "%d" )
diff --git a/util/rast-search/rast-register.rb b/util/rast-search/rast-register.rb
index b35b77b..381601f 100755
--- a/util/rast-search/rast-register.rb
+++ b/util/rast-search/rast-register.rb
@@ -212,7 +212,7 @@ module ::TDiary
@db.register(body, properties)
end
end
-
+
protected
def mode; 'day'; end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/tdiary-contrib.git
More information about the Pkg-ruby-extras-commits
mailing list