tdiary 4.0.2.20140201 → 4.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -0
  3. data/ChangeLog +3 -0
  4. data/Gemfile +5 -5
  5. data/Gemfile.lock +48 -29
  6. data/README.md +1 -1
  7. data/Rakefile +1 -1
  8. data/index.rb +2 -2
  9. data/js/01conf.js +16 -0
  10. data/misc/convert2.rb +3 -3
  11. data/misc/filter/limitdays.rb +2 -2
  12. data/misc/filter/linkcheck.rb +2 -2
  13. data/misc/lib/fcgi_patch.rb +3 -3
  14. data/misc/paas/cloudfoundry/Gemfile.lock +51 -48
  15. data/misc/paas/heroku/Gemfile.lock +23 -21
  16. data/misc/paas/sqale/Gemfile.lock +23 -21
  17. data/misc/plugin/a.rb +4 -4
  18. data/misc/plugin/calendar2.rb +1 -1
  19. data/misc/plugin/category.rb +3 -3
  20. data/misc/plugin/comment_emoji_autocomplete.rb +1 -1
  21. data/misc/plugin/comment_mail-qmail.rb +1 -1
  22. data/misc/plugin/comment_mail-sendmail.rb +1 -1
  23. data/misc/plugin/comment_mail-smtp.rb +1 -1
  24. data/misc/plugin/counter.rb +27 -27
  25. data/misc/plugin/disp_referrer.rb +1 -1
  26. data/misc/plugin/en/amazon.rb +2 -2
  27. data/misc/plugin/en/category.rb +1 -1
  28. data/misc/plugin/en/counter.rb +1 -1
  29. data/misc/plugin/en/disp_referrer.rb +1 -1
  30. data/misc/plugin/en/kw.rb +1 -1
  31. data/misc/plugin/en/search_form.rb +1 -1
  32. data/misc/plugin/en/todo.rb +1 -1
  33. data/misc/plugin/en/weather.rb +5 -2
  34. data/misc/plugin/image.rb +2 -2
  35. data/misc/plugin/ja/disp_referrer.rb +7 -7
  36. data/misc/plugin/ja/my-sequel.rb +1 -1
  37. data/misc/plugin/ja/recent_comment3.rb +1 -1
  38. data/misc/plugin/ja/referer_scheme.rb +1 -1
  39. data/misc/plugin/ja/search_control.rb +1 -1
  40. data/misc/plugin/ja/search_form.rb +2 -2
  41. data/misc/plugin/ja/todo.rb +1 -1
  42. data/misc/plugin/ja/weather.rb +17 -12
  43. data/misc/plugin/makelirs.rb +4 -4
  44. data/misc/plugin/my-ex.rb +1 -1
  45. data/misc/plugin/my-sequel.rb +1 -1
  46. data/misc/plugin/pb-show.rb +1 -1
  47. data/misc/plugin/recent_comment.rb +5 -5
  48. data/misc/plugin/recent_comment3.rb +2 -2
  49. data/misc/plugin/recent_namazu.rb +4 -4
  50. data/misc/plugin/recent_rss.rb +7 -7
  51. data/misc/plugin/referer_scheme.rb +2 -2
  52. data/misc/plugin/search-default.rb +1 -1
  53. data/misc/plugin/sn.rb +3 -3
  54. data/misc/plugin/speed_comment.rb +1 -1
  55. data/misc/plugin/squeeze.rb +8 -8
  56. data/misc/plugin/tb-show.rb +1 -1
  57. data/misc/plugin/theme_online.rb +25 -0
  58. data/misc/plugin/tlink.rb +2 -2
  59. data/misc/plugin/todo.rb +2 -2
  60. data/misc/plugin/weather.rb +82 -26
  61. data/misc/plugin/whatsnew.rb +1 -1
  62. data/misc/plugin/xmlrpc/xmlrpc.rb +11 -11
  63. data/misc/theme_convert/theme_convert.rb +3 -3
  64. data/plugin/00default.rb +35 -28
  65. data/plugin/50sp.rb +1 -1
  66. data/plugin/60sf.rb +1 -1
  67. data/plugin/90migrate.rb +2 -2
  68. data/plugin/en/00default.rb +1 -1
  69. data/plugin/ja/00default.rb +1 -1
  70. data/spec/acceptance/append_comment_spec.rb +18 -18
  71. data/spec/acceptance/append_diary_spec.rb +22 -22
  72. data/spec/acceptance/bugfix/encoding_error_spec.rb +1 -1
  73. data/spec/acceptance/save_conf_comment_spec.rb +15 -15
  74. data/spec/acceptance/save_conf_default_spec.rb +26 -26
  75. data/spec/acceptance/save_conf_dnsbl_spec.rb +19 -19
  76. data/spec/acceptance/save_conf_filter_spec.rb +6 -6
  77. data/spec/acceptance/save_conf_plugin_spec.rb +11 -11
  78. data/spec/acceptance/save_conf_referer_spec.rb +4 -4
  79. data/spec/acceptance/save_conf_security_spec.rb +28 -28
  80. data/spec/acceptance/update_diary_spec.rb +16 -16
  81. data/spec/acceptance/view_category_spec.rb +1 -1
  82. data/spec/acceptance/view_comment_spec.rb +6 -6
  83. data/spec/acceptance/view_diary_spec.rb +25 -25
  84. data/spec/acceptance/view_referer_spec.rb +3 -3
  85. data/spec/core/compatible_spec.rb +5 -5
  86. data/spec/core/configuration_spec.rb +3 -3
  87. data/spec/core/core_ext_spec.rb +7 -7
  88. data/spec/core/io/default_spec.rb +1 -1
  89. data/spec/core/plugin_spec.rb +41 -41
  90. data/spec/core/rack/assets/precompile_spec.rb +3 -3
  91. data/spec/core/rack/html_anchor_spec.rb +15 -15
  92. data/spec/core/rack/static_spec.rb +3 -3
  93. data/spec/core/rack/valid_request_path_spec.rb +13 -13
  94. data/spec/core/style/tdiary_style_spec.rb +10 -10
  95. data/spec/core/style/wiki_style_spec.rb +16 -16
  96. data/spec/plugin/bq_spec.rb +2 -2
  97. data/spec/spec_helper.rb +3 -1
  98. data/tdiary/configuration.rb +2 -2
  99. data/tdiary/environment.rb +1 -1
  100. data/tdiary/io/default.rb +1 -1
  101. data/tdiary/lang/ja.rb +2 -2
  102. data/tdiary/tasks/db.rake +5 -5
  103. data/tdiary/version.rb +1 -1
  104. data/test/disp_referrer_test.rb +4 -4
  105. data/test/my-sequel_test.rb +1 -1
  106. data/test/test_plugin_helper.rb +47 -0
  107. data/test/weather-ADDS-METARS-PHTO-140131.html +109 -0
  108. data/test/weather-ADDS-METARS-RJAA-130131.html +111 -0
  109. data/test/weather-ADDS-METARS-RJAA-130227.html +111 -0
  110. data/test/weather_test.rb +144 -18
  111. data/update.rb +2 -2
  112. metadata +10 -3
@@ -103,7 +103,7 @@ def calendar2(days_format = nil, navi_format = nil, show_todo = nil)
103
103
  @date
104
104
  end
105
105
  year = date.year
106
- month = date.month
106
+ month = date.month
107
107
  p_c_n = calendar2_prev_current_next
108
108
 
109
109
  result = <<CALENDAR_HEAD
@@ -28,7 +28,7 @@ def category_icon_init
28
28
  @conf['category.icon'].split(/\n/).each do |l|
29
29
  c, i = l.split
30
30
  next if c.nil? or i.nil?
31
- @category_icon[c] = i if File.exists?("#{@category_icon_dir}#{i}".untaint)
31
+ @category_icon[c] = i if File.exist?("#{@category_icon_dir}#{i}".untaint)
32
32
  end
33
33
  end
34
34
  category_icon_init
@@ -42,7 +42,7 @@ end
42
42
 
43
43
  def category_anchor(category)
44
44
  period = @conf['category.period'] || 'quarter'
45
- period_string =
45
+ period_string =
46
46
  case period
47
47
  when "month"
48
48
  "year=#{@date.year};month=#{'%02d' % @date.month};"
@@ -178,7 +178,7 @@ def category_dropdown_list(label = nil, multiple = nil)
178
178
  category = info.category
179
179
  if category.empty?
180
180
  return '' if @cgi.mobile_agent?
181
- category = ['ALL']
181
+ category = ['ALL']
182
182
  end
183
183
 
184
184
  options = ''
@@ -11,7 +11,7 @@ if !@cgi.mobile_agent? && /\A(?:day)\z/ =~ @mode
11
11
  add_header_proc do
12
12
  %Q|<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"/>|
13
13
  end
14
-
14
+
15
15
  enable_js('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js')
16
16
  enable_js('caretposition.js')
17
17
  enable_js('comment_emoji_autocomplete.js')
@@ -19,7 +19,7 @@
19
19
  # @options['comment_mail.receivers']
20
20
  # メールを送るアドレス文字列。カンマで区切って複数指定できる。
21
21
  # 無指定時には日記筆者のアドレスになる。
22
- #
22
+ #
23
23
  # tdiary.confでのみ指定できるもの:
24
24
  # @options['comment_mail.qmail']
25
25
  # qmail_injectコマンドのパスを指定する。
@@ -19,7 +19,7 @@
19
19
  # @options['comment_mail.receivers']
20
20
  # メールを送るアドレス文字列。カンマで区切って複数指定できる。
21
21
  # 無指定時には日記筆者のアドレスになる。
22
- #
22
+ #
23
23
  # tdiary.confでのみ指定できるもの:
24
24
  # @options['comment_mail.sendmail']
25
25
  # sendmailコマンドのパスを指定する。
@@ -19,7 +19,7 @@
19
19
  # @options['comment_mail.receivers']
20
20
  # メールを送るアドレス文字列。カンマで区切って複数指定できる。
21
21
  # 無指定時には日記筆者のアドレスになる。
22
- #
22
+ #
23
23
  # tdiary.confでのみ指定できるもの:
24
24
  # @options['comment_mail.smtp_host']
25
25
  # @options['comment_mail.smtp_port']
@@ -20,12 +20,12 @@
20
20
  #
21
21
  # 2. Documents
22
22
  # See URLs below for more details.
23
- # http://ponx.s5.xrea.com/hiki/counter.rb.html (English)
24
- # http://ponx.s5.xrea.com/hiki/ja/counter.rb.html (Japanese)
23
+ # http://ponx.s5.xrea.com/hiki/counter.rb.html (English)
24
+ # http://ponx.s5.xrea.com/hiki/ja/counter.rb.html (Japanese)
25
25
  #
26
26
  # Copyright (c) 2002-2006 Masao Mutoh
27
27
  # You can redistribute it and/or modify it under GPL2.
28
- #
28
+ #
29
29
  =begin ChangeLog
30
30
  2006-02-14 Masao Mutoh
31
31
  * Add some user-agents.
@@ -33,18 +33,18 @@
33
33
 
34
34
  2006-02-14 mitty
35
35
  * Fixed a problem when counter2_access.dat is broken.
36
-
36
+
37
37
  2006-02-07 Masao Mutoh
38
38
  * Revert the log file name from counter2.log to counter.log.
39
39
  Reported by Ken-ichi Mito.
40
40
  * 2.0.1
41
-
41
+
42
42
  2006-01-20 Masao Mutoh
43
43
  * Improves the speed and stability.
44
44
  - Separate data to counterdata and accessdata.
45
45
  - counterdata is the target of backup, but accessdata doesn't do backup.
46
46
  - change a key of an Array of String to a hash.
47
- - Removed "counter.daily_backup" option. Now daily_backup is applied
47
+ - Removed "counter.daily_backup" option. Now daily_backup is applied
48
48
  everyday unless this setting.
49
49
  - Add a new "counter.max_keep_access_num" option which you can set the max
50
50
  number to keep users in the accessdata file to avoid to become
@@ -155,7 +155,7 @@
155
155
  アクセスした場合に@todayが0になる不具合の修正
156
156
  * コメント入れたときに数字が表示されない不具合の修正
157
157
  * HEADでアクセスがあった場合はカウントしないようにした
158
- (reported by NT<nt@24i.net>, suggested a solution
158
+ (reported by NT<nt@24i.net>, suggested a solution
159
159
  by TADA Tadashi <sho@spc.gr.jp>)
160
160
  * version 1.0.2
161
161
 
@@ -195,7 +195,7 @@ if @cgi.request_method == 'GET' and counter_allow?
195
195
  require 'date'
196
196
  require 'pstore'
197
197
  require 'fileutils'
198
-
198
+
199
199
  eval(<<TOPLEVEL_CLASS, TOPLEVEL_BINDING)
200
200
  class TDiaryAccessData
201
201
  attr_accessor :ignore_cookie #means ALWAYS ignore a cookie.
@@ -251,7 +251,7 @@ eval(<<TOPLEVEL_CLASS, TOPLEVEL_BINDING)
251
251
  eval(io.read)
252
252
  end
253
253
  rescue Exception
254
- back = (Dir.glob(File.join(@path, "counter2.dat.?")).sort{|a,b|
254
+ back = (Dir.glob(File.join(@path, "counter2.dat.?")).sort{|a,b|
255
255
  File.mtime(a) <=> File.mtime(b)}.reverse)[0]
256
256
  open(back, "r") do |io|
257
257
  begin
@@ -317,7 +317,7 @@ TOPLEVEL_CLASS
317
317
  cookie = nil
318
318
  if FileTest.exist?(File.join(dir, "counter.dat"))
319
319
  db = PStore.new(File.join(dir, "counter.dat"))
320
- db.transaction do
320
+ db.transaction do
321
321
  old = db["countdata"]
322
322
  TDiaryCountData.new(dir, old.all, old.today, old.yesterday).save
323
323
  end
@@ -342,8 +342,8 @@ TOPLEVEL_CLASS
342
342
  changed = false
343
343
  if new_user?(cgi, options)
344
344
  @cnt.up(today, dir, cgi, (options and options["counter.log"]))
345
- cookie = CGI::Cookie.new({"name" => "tdiary_counter",
346
- "value" => @version,
345
+ cookie = CGI::Cookie.new({"name" => "tdiary_counter",
346
+ "value" => @version,
347
347
  "expires" => Time.now + timer * 3600})
348
348
  changed = true
349
349
  end
@@ -353,13 +353,13 @@ TOPLEVEL_CLASS
353
353
  if options["counter.kiriban"] == ""
354
354
  options["counter.kiriban"] = [-1]
355
355
  elsif options["counter.kiriban"].include?(",")
356
- options["counter.kiriban"] =
356
+ options["counter.kiriban"] =
357
357
  options["counter.kiriban"].split(",").collect{|i| i.to_i}
358
358
  else
359
359
  options["counter.kiriban"] = [options["counter.kiriban"].to_i]
360
360
  end
361
361
  end
362
- @kiriban = options["counter.kiriban"].include?(@cnt.all + @init_num)
362
+ @kiriban = options["counter.kiriban"].include?(@cnt.all + @init_num)
363
363
  end
364
364
 
365
365
  if ! @kiriban and options["counter.kiriban_today"]
@@ -367,7 +367,7 @@ TOPLEVEL_CLASS
367
367
  if options["counter.kiriban_today"] == ""
368
368
  options["counter.kiriban_today"] = [-1]
369
369
  elsif options["counter.kiriban_today"].include?(",")
370
- options["counter.kiriban_today"] =
370
+ options["counter.kiriban_today"] =
371
371
  options["counter.kiriban_today"].split(",").collect{|i| i.to_i}
372
372
  else
373
373
  options["counter.kiriban_today"] = [options["counter.kiriban_today"].to_i]
@@ -381,7 +381,7 @@ TOPLEVEL_CLASS
381
381
  changed = true
382
382
  end
383
383
 
384
- #when it is kiriban time, ignore the cookie next access time.
384
+ #when it is kiriban time, ignore the cookie next access time.
385
385
  if @kiriban or @kiriban_today
386
386
  @access.ignore_cookie = true
387
387
  changed = true
@@ -396,13 +396,13 @@ TOPLEVEL_CLASS
396
396
 
397
397
  def new_user_without_cookie?(cgi, options)
398
398
  if options
399
- interval = options["counter.deny_same_src_interval"]
400
- maxaccessnum = options["counter.max_keep_access_num"]
399
+ interval = options["counter.deny_same_src_interval"]
400
+ maxaccessnum = options["counter.max_keep_access_num"]
401
401
  end
402
402
  interval = 2 unless interval # 2 hour.
403
403
  maxaccessnum = 10000 unless maxaccessnum # 2 hour.
404
404
  current_time = Time.now
405
- previous_access_time = @access.previous_access_time(current_time, cgi.remote_addr,
405
+ previous_access_time = @access.previous_access_time(current_time, cgi.remote_addr,
406
406
  cgi.user_agent, interval, maxaccessnum)
407
407
  if previous_access_time
408
408
  ret = current_time - previous_access_time > interval * 3600
@@ -414,7 +414,7 @@ TOPLEVEL_CLASS
414
414
 
415
415
  def new_user?(cgi, options)
416
416
  return true if @access.ignore_cookie
417
- if cgi.cookies
417
+ if cgi.cookies
418
418
  if cgi.cookies.keys.include?("tdiary_counter")
419
419
  ret = false
420
420
  else
@@ -435,7 +435,7 @@ TOPLEVEL_CLASS
435
435
  result << %Q[<img src="#{h theme_url}/#{yield(num)}" alt="#{num}" />]
436
436
  elsif filetype == ""
437
437
  result << %Q[<span class="counter-#{depth}"><span class="counter-num-#{num}">#{num}</span></span>]
438
- else
438
+ else
439
439
  result << %Q[<img src="#{h theme_url}/#{num}.#{filetype}" alt="#{num}" />]
440
440
  end
441
441
  depth += 1
@@ -451,13 +451,13 @@ TOPLEVEL_CLASS
451
451
  def kiriban?; @kiriban; end
452
452
  def kiriban_today?; @kiriban_today; end
453
453
 
454
- module_function :new_user?, :new_user_without_cookie?, :all, :today, :yesterday, :format,
454
+ module_function :new_user?, :new_user_without_cookie?, :all, :today, :yesterday, :format,
455
455
  :main, :run, :kiriban?, :kiriban_today?
456
456
  end
457
457
 
458
458
  #init_num is deprecated.
459
459
  #please replace it to @options["counter.init_num"]
460
- def counter(figure = 0, filetype = "", init_num = 0, &proc)
460
+ def counter(figure = 0, filetype = "", init_num = 0, &proc)
461
461
  TDiaryCounter.format("", theme_url, TDiaryCounter.all, figure, filetype, init_num, &proc)
462
462
  end
463
463
 
@@ -543,11 +543,11 @@ def print_conf_html
543
543
  @conf["counter.kiriban"] ||= ""
544
544
  if @conf["counter.kiriban"].kind_of? Array
545
545
  @conf["counter.kiriban"] = @conf["counter.kiriban"].join(", ")
546
- end
546
+ end
547
547
  @conf["counter.kiriban_today"] ||= ""
548
548
  if @conf["counter.kiriban_today"].kind_of? Array
549
549
  @conf["counter.kiriban_today"] = @conf["counter.kiriban_today"].join(", ")
550
- end
550
+ end
551
551
 
552
552
  @conf["counter.kiriban_msg"] ||= ""
553
553
  @conf["counter.kiriban_today_msg"] ||= ""
@@ -565,7 +565,7 @@ def print_conf_html
565
565
  @conf["counter.kiriban_msg"] = @conf.to_native(@cgi.params["counter.kiriban_msg"][0]).gsub(/\r\n/, "\n" ).gsub(/\r/, '').sub(/\n+\z/, '')
566
566
  @conf["counter.kiriban_today_msg"] = @conf.to_native(@cgi.params["counter.kiriban_today_msg"][0]).gsub(/\r\n/, "\n").gsub(/\r/, '').sub(/\n+\z/, '')
567
567
  @conf["counter.kiriban_nomatch_msg"] = @conf.to_native(@cgi.params["counter.kiriban_nomatch_msg"][0]).gsub(/\r\n/, "\n").gsub(/\r/, '').sub(/\n+\z/, '')
568
- end
568
+ end
569
569
 
570
570
  <<-HTML
571
571
  <h3 class="subtitle">#{@counter_conf_init_head}</h3>
@@ -619,7 +619,7 @@ def print_conf_html
619
619
  end
620
620
 
621
621
  # Configure
622
- add_conf_proc('counter', @counter_conf_counter) do
622
+ add_conf_proc('counter', @counter_conf_counter) do
623
623
  print_conf_html
624
624
  end
625
625
 
@@ -1169,7 +1169,7 @@ class DispRef2SetupIF
1169
1169
  # setup mode
1170
1170
  Options = 'options'
1171
1171
  RefList = 'reflist'
1172
-
1172
+
1173
1173
  def initialize( cgi, setup, conf, mode )
1174
1174
  @cgi = cgi
1175
1175
  @setup = setup
@@ -11,7 +11,7 @@
11
11
  # asin: ASIN or ISBN
12
12
  # comment: comment (optional)
13
13
  #
14
- # isbn_image_right:
14
+ # isbn_image_right:
15
15
  # Parameter:
16
16
  # asin: ASIN or ISBN
17
17
  # comment: comment (optional)
@@ -38,7 +38,7 @@
38
38
  # amazon.rb uses images on tDiary.org when this
39
39
  # option not specified. If you want to use your
40
40
  # original images, modify PNG file in amazon directory.
41
- # @options['amazon.nodefault']: If you dosen't want to show default image
41
+ # @options['amazon.nodefault']: If you dosen't want to show default image
42
42
  # when the book image not found, set true.
43
43
 
44
44
  @amazon_default_country = 'us'
@@ -95,7 +95,7 @@ HTML
95
95
  <h3 class="subtitle">Header</h3>
96
96
  <p>
97
97
  This text is inserted into top of category view.
98
- "&lt;%= category_navi %&gt;" genaretes navigation buttons for category,
98
+ "&lt;%= category_navi %&gt;" genaretes navigation buttons for category,
99
99
  and "&lt;%= category_list %&gt;" lists all category names.
100
100
  You can use plugins and write any HTML tags.
101
101
  </p>
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # Copyright (c) 2006 Masao Mutoh
6
6
  # You can redistribute it and/or modify it under GPL2.
7
- #
7
+ #
8
8
 
9
9
  @counter_conf_counter ||= "Access counter"
10
10
  @counter_conf_init_head ||= "Initial number"
@@ -71,7 +71,7 @@ Disp_referrer2_with_Nora = <<'_END'.taint
71
71
  _END
72
72
  Disp_referrer2_without_Nora = <<'_END'.taint
73
73
  <!-- p>
74
- Please install the
74
+ Please install the
75
75
  <a href="http://www.moonwolf.com/ruby/archive/nora-20040830.tar.gz">Nora
76
76
  library</a> if you feel the pages show too slowly.
77
77
  </p -->
data/misc/plugin/en/kw.rb CHANGED
@@ -4,7 +4,7 @@ end
4
4
 
5
5
  def kw_desc
6
6
  <<-HTML
7
- <p>kw(KeyWord) plugin generate a Link by simple words. You can specify keywords
7
+ <p>kw(KeyWord) plugin generate a Link by simple words. You can specify keywords
8
8
  as space sepalated value: "keyword URL". For example,</p>
9
9
  <pre>google http://www.google.com/search?q=$1</pre>
10
10
  <p>then you specify in your diary as:</p>
@@ -2,7 +2,7 @@
2
2
 
3
3
  def google_form( button_name = "Google Search", size = 20, default_text = "" )
4
4
  first = %Q[<a href="http://www.google.com/">
5
- <img src="http://www.google.com/logos/Logo_40wht.gif"
5
+ <img src="http://www.google.com/logos/Logo_40wht.gif"
6
6
  style="border-width: 0px; vertical-align: middle;" alt="Google"></a>]
7
7
  search_form( "http://www.google.com/search", "q", button_name, size, default_text, first, '' )
8
8
  end
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # Copyright (c) 2001,2002,2003 Junichiro KITA <kita@kitaj.no-ip.com>
6
6
  # Distributed under the GPL
7
- #
7
+ #
8
8
 
9
9
  def todo_msg_today; "today"; end
10
10
  def todo_msg_in_time(days); "#{days} day(s) left to go"; end
@@ -126,6 +126,8 @@ end
126
126
 
127
127
  # www configuration interface
128
128
  def weather_configure_html( conf )
129
+ station = Weather::extract_station_id(conf['weather.url'])
130
+ station ||= conf['weather.url']
129
131
  <<-HTML
130
132
  <h3 class="subtitle">Weather-of-today plugin</h3>
131
133
  <p>Records the weather when the diary is first updated for the date
@@ -136,8 +138,9 @@ def weather_configure_html( conf )
136
138
  <a href="http://weather.noaa.gov/">NOAA National Weather Service</a>
137
139
  and push the &quot;Go!&quot; button.
138
140
  Then select the observation point.
139
- Write down the URL of the page shown in the box below.</p>
140
- <p><input name="weather.url" value="#{conf['weather.url']}" size="60"></p>
141
+ Write down the URL of the page shown in the box below.
142
+ The four letter station ID can also be used here.</p>
143
+ <p><input name="weather.url" value="#{station}" size="60"></p>
141
144
  <p>It would be better to record your time zone in the data if you are
142
145
  likely to move to another time zone in the future.
143
146
  Thus, the weather data will be shown in the local time where the
data/misc/plugin/image.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # image.rb
3
3
  # -pv-
4
- #
4
+ #
5
5
  # 名称:
6
6
  # 絵日記Plugin
7
7
  #
@@ -129,7 +129,7 @@ FileUtils.mkdir_p @image_dir unless File.exist?(@image_dir)
129
129
 
130
130
  @image_maxwidth = @options && @options['image.maxwidth'] || nil
131
131
 
132
- add_body_enter_proc do |date|
132
+ add_body_enter_proc do |date|
133
133
  @image_date = date.strftime( "%Y%m%d" )
134
134
  ""
135
135
  end
@@ -49,7 +49,7 @@
49
49
  初めて設定する時には、
50
50
  Insecure: can't modify hash (SecurityError)
51
51
  というエラーが出る可能性があります。これはtDiaryの問題です。この場合には、
52
- tDiaryを新しくして1.5.5.20030806以降を使うか、「基本」から何も変更せず
52
+ tDiaryを新しくして1.5.5.20030806以降を使うか、「基本」から何も変更せず
53
53
  に「OK」を押すことでエラーを回避できるでしょう。
54
54
 
55
55
  リンク元置換リストやオプションを変更した場合は、キャッシュディレクトリ
@@ -588,18 +588,18 @@ DispReferrer2_Engines = {
588
588
  '102' => [[%r{\Ahttp://66\.102\.(?:[0-9]|1[0-5])\.\d+/}i, '"Google検索"', [:prev, 'as_q', 'q'], DispReferrer2_Google_cache]],
589
589
  # other google candidates:
590
590
  # % whois 216.239.37.104
591
- # NetRange: 216.239.32.0 - 216.239.63.255
592
- # CIDR: 216.239.32.0/19
591
+ # NetRange: 216.239.32.0 - 216.239.63.255
592
+ # CIDR: 216.239.32.0/19
593
593
  # NetName: GOOGLE
594
594
  '216' => [[%r{\Ahttp://216\.239\.(?:3[2-9]|[4-5]\d|6[0-3])\.\d+/}i, '"Google検索"', [:prev, 'as_q', 'q'], DispReferrer2_Google_cache]],
595
595
  # % whois 72.14.203.104
596
- # NetRange: 72.14.192.0 - 72.14.239.255
597
- # CIDR: 72.14.192.0/19, 72.14.224.0/20
596
+ # NetRange: 72.14.192.0 - 72.14.239.255
597
+ # CIDR: 72.14.192.0/19, 72.14.224.0/20
598
598
  # NetName: GOOGLE
599
599
  '14' => [[%r{\Ahttp://72\.14\.(?:19[2-9]|2\d\d)\.\d+/}i, '"Google検索"', [:prev, 'as_q', 'q'], DispReferrer2_Google_cache]],
600
600
  # % whois 66.249.93.104
601
- # NetRange: 66.249.64.0 - 66.249.95.255
602
- # CIDR: 66.249.64.0/19
601
+ # NetRange: 66.249.64.0 - 66.249.95.255
602
+ # CIDR: 66.249.64.0/19
603
603
  # NetName: GOOGLE
604
604
  '249' => [[%r{\Ahttp://66\.249\.(?:6[4-9]|[7-8]\d|9[0-5])\.\d+/}i, '"Google検索"', [:prev, 'as_q', 'q'], DispReferrer2_Google_cache]],
605
605
  'ezweb' => [[%r{\Ahttp://ezsch\.ezweb\.ne\.jp/search/}i, '"EZweb検索"', ['query'], nil]],
@@ -40,7 +40,7 @@ margin: 0px;
40
40
  _END
41
41
  :description => '後日談へのリンクに設定されるCSSです。div.sequelに適用されます。',
42
42
  :index => 3,
43
- :textarea => {:rows => 5},
43
+ :textarea => {rows: 5},
44
44
  },
45
45
  }
46
46
 
@@ -31,7 +31,7 @@ if @mode == 'conf' || @mode == 'saveconf'
31
31
  <h3 class="subtitle">ツリー表示時のタイトルの長さ</h3>
32
32
  <p>ツリー表示機能を使用する時のタイトルの長さを指定します。ツリー表示機能を使用しない場合には関係ありません。</p>
33
33
  <p>最大 <input name="recent_comment3.titlelen" value="#{h( @conf['recent_comment3.titlelen'] )}" size="3" /> 文字</p>
34
-
34
+
35
35
  <h3 class="subtitle">生成するHTMLのテンプレート</h3>
36
36
  <p>各ツッコミをどのようなHTMLで表示するかを指定します.</p>
37
37
  <textarea name="recent_comment3.format" cols="70" rows="3">#{h( @conf['recent_comment3.format'] )}</textarea>
@@ -53,7 +53,7 @@ unless @conf.referer_table.respond_to?( 'scheme_tdiarynet', true ) then
53
53
  class << @conf.referer_table
54
54
  private
55
55
  TdiaryNet = '\.tdiary\.net/'
56
-
56
+
57
57
  def scheme_tdiarynet( url, name )
58
58
  TdiaryDates.each do |a|
59
59
  yield( "http://#{url}#{TdiaryNet}#{a[0]}", name + a[1] )
@@ -15,7 +15,7 @@
15
15
  うな動作を期待するか設定することができます。デフォルトでは、一日分の表示
16
16
  のみ、検索エンジンに登録されるようになっています。
17
17
 
18
- 実際に効果があるかどうかは、検索エンジンのロボットがメタタグを解釈して
18
+ 実際に効果があるかどうかは、検索エンジンのロボットがメタタグを解釈して
19
19
  くれるかどうかにかかっています。
20
20
 
21
21
  secure==trueな日記でも使えます。
@@ -3,7 +3,7 @@
3
3
 
4
4
  def googlej_form( button_name = "Google 検索", size = 20, default_text = "" )
5
5
  first = %Q[<a href="http://www.google.com/">
6
- <img src="http://www.google.com/logos/Logo_40wht.gif"
6
+ <img src="http://www.google.com/logos/Logo_40wht.gif"
7
7
  style="border-width: 0px; vertical-align: middle;" alt="Google"></a>]
8
8
  last = %Q[<input type="hidden" name="hl" value="ja"><input type="hidden" name="ie" value="utf-8">]
9
9
  search_form( "http://www.google.com/search", "q", button_name, size, default_text, first, last )
@@ -15,7 +15,7 @@ end
15
15
 
16
16
  def yahooj_form( button_name = "Yahoo! 検索", size = 20, default_text = "" )
17
17
  first = %Q[<a href="http://www.yahoo.co.jp/">
18
- <img src="http://img.yahoo.co.jp/images/yahoojp_sm.gif"
18
+ <img src="http://img.yahoo.co.jp/images/yahoojp_sm.gif"
19
19
  style="border-width: 0px; vertical-align: middle;" alt="Yahoo! JAPAN"></a>]
20
20
  search_form( "http://search.yahoo.co.jp/bin/search", "p", button_name, size, default_text, first, "" )
21
21
  end
@@ -5,7 +5,7 @@
5
5
  #
6
6
  # Copyright (c) 2001,2002,2003 Junichiro KITA <kita@kitaj.no-ip.com>
7
7
  # Distributed under the GPL
8
- #
8
+ #
9
9
 
10
10
  def todo_msg_today; "今日"; end
11
11
  def todo_msg_in_time(days); "あと#{days}日"; end
@@ -16,7 +16,7 @@ EUC-JPです。
16
16
 
17
17
  次に、tdiary.confを編集するか、WWWブラウザからtDiaryの設定画面から「その
18
18
  日の天気」を選んで、天気データをいただいてくるURLを設定してください。
19
- tdiary.confを編集する場合には、@options['weather.url']に設定してくださ
19
+ tdiary.confを編集する場合には、@options['weather.url']に設定してくださ
20
20
  い。両方で設定をした場合には、tDiaryの設定画面での設定が優先されます。
21
21
 
22
22
  例えば、 NOAA National Weather Serviceを利用する場合には、
@@ -29,8 +29,8 @@ tdiary.confを編集する場合には、@options['weather.url']に設定して
29
29
  うなWWWページから情報を取得しないように注意してください。
30
30
 
31
31
  さらに、将来日記のタイムゾーンが変化する可能性がある方は、今のタイムゾー
32
- ンを、@options['weather.tz']か、環境変数TZに設定しておくことをお勧めし
33
- ます。これによって、日記が引越した後も、天気データ取得時のタイムゾーン
32
+ ンを、@options['weather.tz']か、環境変数TZに設定しておくことをお勧めし
33
+ ます。これによって、日記が引越した後も、天気データ取得時のタイムゾーン
34
34
  で天気を表示し続けることができます。tdiary.confに設定する場合は、例えば
35
35
  日本標準時の場合は、
36
36
  @options['weather.tz'] = 'Japan'
@@ -65,7 +65,7 @@ tdiary.confに
65
65
 
66
66
  天気データは、@options['weather.dir']に設定したディレクトリか、
67
67
  @cache_path/weather/ ディレクトリ以下に、年/年月.weather というファイ ル
68
- 名で保存されます。タブ区切りのテキストファイルですので必要に応じて編集
68
+ 名で保存されます。タブ区切りのテキストファイルですので必要に応じて編集
69
69
  することができます。タブの数を変えてしまわないように気をつけて編集してく
70
70
  ださい。フォーマットの詳細は、Weather.to_sメソッドを参照してください。
71
71
 
@@ -105,7 +105,7 @@ tdiary.confに
105
105
  trueの場合は、携帯端末からのアクセスの場合に、i_html_stringで生成され
106
106
  たCHTMLを表示します。falseの場合は、携帯端末からのアクセスの場合には天
107
107
  気を表示しません。ブラウザから設定した場合はそちらが優先されます。
108
-
108
+
109
109
  : @options['weather.tz']
110
110
  データを取得した場所のタイムゾーン。コマンドライン上で例えば、
111
111
  TZ=Japan date
@@ -114,10 +114,10 @@ tdiary.confに
114
114
  から設定した場合はそちらが優先されます。このオプションが指定されてい
115
115
  ない場合、環境変数TZが設定されていればその値を使用します。そうでなけ
116
116
  ればタイムゾーンは記録しません。
117
-
117
+
118
118
  天気データにタイムゾーンが記録されていない場合は、もし将来日記のタイム
119
119
  ゾーンが変更された場合に違う時刻を表示することになります。
120
-
120
+
121
121
  日付の判定など、天気データの記録以外の時刻の管理には、日記全体のタイム
122
122
  ゾーンが用いられます。
123
123
 
@@ -162,7 +162,7 @@ Weatherクラスに、Words_jaという配列定数として与えてありま
162
162
  に書いておくと、そのうち配布元で追加されるかもしれません。
163
163
 
164
164
  == 細かい設定
165
- 天気データ取得元や好みに合わて、以下のメソッドを変更することで、より柔
165
+ 天気データ取得元や好みに合わて、以下のメソッドを変更することで、より柔
166
166
  軟な設定ができます。
167
167
 
168
168
  === 表示に関するもの
@@ -180,8 +180,8 @@ Weatherクラスに、Words_jaという配列定数として与えてありま
180
180
  : Weather.parse_html( html, items )
181
181
  ((|html|))文字列を解析して、((|items|))ハッシュに従って@data[item]を定
182
182
  義してください。((|items|))には@optins['weather.items']または
183
- Weather_default_itemsが代入されます。返り値は利用されません。テーブル
184
- を用いた天気情報源ならば、このメソッドをあまり改造しないで使えるかも
183
+ Weather_default_itemsが代入されます。返り値は利用されません。テーブル
184
+ を用いた天気情報源ならば、このメソッドをあまり改造しないで使えるかも
185
185
  しれません。
186
186
 
187
187
  == まだやるべきこと
@@ -343,6 +343,8 @@ end
343
343
 
344
344
  # www configuration interface
345
345
  def weather_configure_html( conf )
346
+ station = Weather::extract_station_id(conf['weather.url'])
347
+ station ||= conf['weather.url']
346
348
  <<-HTML
347
349
  <h3 class="subtitle">その日の天気プラグイン</h3>
348
350
  <p>その日の天気を、その日の日記を最初に更新する時に取得して保存し、
@@ -352,8 +354,11 @@ def weather_configure_html( conf )
352
354
  <a href="http://weather.noaa.gov/">NOAA National Weather Service</a>
353
355
  から、Select a country...で国名を選んでGo!ボタンを押し、
354
356
  次に観測地点を選んでください。
355
- そして、その時表示されたページのURLを、以下に記入してください。</p>
356
- <p><input name="weather.url" value="#{conf['weather.url']}" size="60"></p>
357
+ そして、その時表示されたページのURL
358
+ (例えば東京ヘリポートの場合は<tt>http://weather.noaa.gov/weather/current/RJTI.html</tt>となります)
359
+ を、以下に記入してください。
360
+ 大文字4文字のStation IDでもかまいません。</p>
361
+ <p><input name="weather.url" value="#{station}" size="50"></p>
357
362
  <p>将来日記のタイムゾーンが変化する可能性がある方は、
358
363
  今のタイムゾーンを記録しておくことをお勧めします。
359
364
  これによって、日記が引越した後も、
@@ -29,21 +29,21 @@ add_update_proc do
29
29
  def utc_offset
30
30
  l = self.dup.localtime
31
31
  u = self.dup.utc
32
-
32
+
33
33
  if l.year != u.year
34
34
  off = l.year < u.year ? -1 : 1
35
35
  elsif l.mon != u.mon
36
36
  off = l.mon < u.mon ? -1 : 1
37
37
  elsif l.mday != u.mday
38
38
  off = l.mday < u.mday ? -1 : 1
39
- else
39
+ else
40
40
  off = 0
41
41
  end
42
-
42
+
43
43
  off = off * 24 + l.hour - u.hour
44
44
  off = off * 60 + l.min - u.min
45
45
  off = off * 60 + l.sec - u.sec
46
-
46
+
47
47
  return off
48
48
  end
49
49
  end
data/misc/plugin/my-ex.rb CHANGED
@@ -25,7 +25,7 @@ def my( a, str, title = nil )
25
25
  idx = 1
26
26
  @diaries[date].each_section do |s|
27
27
  section = s
28
- break if idx == frag.to_i
28
+ break if idx == frag.to_i
29
29
  idx += 1
30
30
  end
31
31
  if section and section.subtitle then
@@ -427,7 +427,7 @@ margin: 0px;
427
427
  _END
428
428
  :description => 'CSS for the links. The followoing is applied to <code>div.sequel</code>.',
429
429
  :index => 3,
430
- :textarea => {:rows => 5},
430
+ :textarea => {rows: 5},
431
431
  },
432
432
  }
433
433