Changeset 7902 for platform/tdiary

Show
Ignore:
Timestamp:
03/13/08 19:58:50 (5 years ago)
Author:
drry
Message:

platform/tdiary/plugin/ja/google_sitemaps.rb
platform/tdiary/plugin/google_sitemaps.rb
platform/tdiary/plugin/jholiday.rb:

  • 文章を少し修正してみました。
  • 正規表現を修正しました。
  • 空白とインデントを修整しました。
Location:
platform/tdiary/plugin
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • platform/tdiary/plugin/google_sitemaps.rb

    r7897 r7902  
    88  headers = Array.new 
    99  header = Hash.new 
    10    
     10 
    1111  Dir.glob(@conf.data_path + '/????/*.td2') { |data_file| 
    1212    File.open(data_file) { |buffer| 
     
    1919          header.clear 
    2020        end 
    21         if %r|^Date: ([0-9]+)$| =~ line then 
     21        if %r|^Date: ([0-9]+)$|i =~ line then 
    2222          header['loc'] = sprintf(@conf['google_sitemaps.uri_format'], $1) 
    2323        end 
    24         if %r|^Last\-Modified: ([0-9]+)$| =~ line then 
     24        if %r|^Last-Modified: ([0-9]+)$|i =~ line then 
    2525          header['lastmod'] = Time.at($1.to_i).iso8601 
    2626        end 
    27         if %r|^Visible: (.+)$| =~ line then 
     27        if %r|^Visible: (.+)$|i =~ line then 
    2828          if $1.upcase == "TRUE" then 
    2929            header['visible'] = true 
     
    3535    } 
    3636  } 
    37    
     37 
    3838  headers.sort! { |a, b| b['loc'] <=> a['loc']} 
    3939 
     
    4242 
    4343  File.open(@conf['google_sitemaps.output_file'], 'w') do |fp| 
    44           fp.write %Q[<?xml version="1.0" encoding="UTF-8"?>\n] 
    45           fp.write %Q[<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">\n] 
    46     fp.write %Q[<url><loc>#{CGI::escapeHTML(top_page_uri)}</loc><lastmod>#{now_datetime}</lastmod></url>\n] 
    47           headers.each { |entry| 
    48             fp.write %Q[<url><loc>#{CGI::escapeHTML(entry['loc'])}</loc><lastmod>#{entry['lastmod']}</lastmod></url>\n] 
    49           } 
    50           fp.write %Q[</urlset>\n] 
     44    fp.write %Q[<?xml version="1.0" encoding="UTF-8"?>\n] 
     45    fp.write %Q[<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">\n] 
     46    fp.write %Q[ <url><loc>#{CGI::escapeHTML(top_page_uri)}</loc><lastmod>#{now_datetime}</lastmod></url>\n] 
     47    headers.each { |entry| 
     48      fp.write %Q[ <url><loc>#{CGI::escapeHTML(entry['loc'])}</loc><lastmod>#{entry['lastmod']}</lastmod></url>\n] 
     49    } 
     50    fp.write %Q[</urlset>\n] 
    5151  end 
    5252end 
  • platform/tdiary/plugin/ja/google_sitemaps.rb

    r7897 r7902  
    1515 
    1616  if File.writable_real?(@conf['google_sitemaps.output_file']) == false 
    17     msg = "<strong>[NG] 指定されているファイルには書き込み権限がありません。</strong>" 
     17    msg = "<strong>[NG] 指定されているファイル書き込み権限がありません。</strong>" 
    1818  else 
    19     msg = "[OK] 指定されているファイルには書き込み権限があります。" 
     19    msg = "[OK] 指定されているファイル書き込み権限があります。" 
    2020  end 
    2121 
    2222  <<-HTML 
    23   <p>Google sitemap用のXMLを出力する設定を行います。</p> 
     23  <p>Google ウェブマスターツール用のSitemap XMLを出力する設定を行います。</p> 
    2424  <h3 class="subtitle">アドレスフォーマット</h3> 
    2525  <p>日付別表示時のURLフォーマットを指定します。日付文字列の部分は<strong>%s</strong>にしてください。</p> 
    2626  <p><input type="text" name="google_sitemaps.uri_format" value="#{ CGI::escapeHTML(@conf['google_sitemaps.uri_format']) }" size="50"></p> 
    27   <div class="section">ex.<br />http://www.example.com/inex.cgi?date=<strong>%s</strong><br />http://www.example.com/<strong>%s</strong>.html</div> 
     27  <div class="section">eg.<br />http://www.example.com/inex.cgi?date=<strong>%s</strong><br />http://www.example.com/<strong>%s</strong>.html</div> 
    2828 
    2929  <h3 class="subtitle">XMLファイルの出力先</h3> 
  • platform/tdiary/plugin/jholiday.rb

    r7898 r7902  
    11require 'Calendar.rb' 
    22require 'date' 
    3 unless Time::new.respond_to?( :strftime_holiday_backup )    
     3unless Time::new.respond_to?( :strftime_holiday_backup ) 
    44then 
    55 eval( <<-MODIFY_CLASS, TOPLEVEL_BINDING )