Create  メモリーズオフ  Index  Search  Changes  PageRank  RSS  Note  Login

hiki Diff

  • Added parts are displayed like this.
  • Deleted parts are displayed like this.

{{toc}}
!HTML文法修正
目についた文法エラーだけ。
!!tocプラグインの箇条書き
style/default/html_formatter.rbの44行目〜66行目を

     def toc
       s = "<ul>\n"
       num = -1
       level = 1
       to_s unless @html_converted
       @html_converted.each_line do |line|
         if HEADING_RE =~ line
           new_level = $1.to_i - 1
           num += 1
           title = $2.gsub( TAG_RE, '' ).strip
           if new_level > level
             s << ( "<ul>\n" * ( new_level - level ) )
             level = new_level
           elsif new_level < level
             s << ( "</ul>\n" * ( level - new_level ) )
             level = new_level
           end
           s << %Q!<li><a href="\#l#{num}">#{title}</a></li>\n!
         end
       end
       s << ("</ul>\n" * level)
       s
     end

次のように修正。

    def toc
      s = "\n<ul>\n"
      num = -1
      level = 1
      to_s unless @html_converted
      @html_converted.each_line do |line|
        if HEADING_RE =~ line
          new_level = $1.to_i - 1
          num += 1
          title = $2.gsub( TAG_RE, '' ).strip
  if new_level > level
            s << ( "\n<ul>\n" * ( new_level - level ) )
          elsif new_level < level
            s << ("</li>\n</ul>" * ( level - new_level ) +"</li>\n")
          end
                if (num > 0)
                    if new_level == level
                        s << ("</li>\n")
                    end
                end
            level = new_level
          s << %Q!<li><a href="\#l#{num}">#{title}</a>!
        end
      end
      s << ("</li>\n</ul>\n" * level)
      s
    end
!!recentプラグイン
plugin/00default.rbの95行目を次のように修正。

*''<h5>''→''<p><strong>''
*''</h5>''→''</strong></p>''

!静的URI

*[[hiki.cgi?hoge じゃなく hoge.html でアクセスしてもらうには|http://hikiwiki.org/ja/PretendStaticURL.html]]のとおり、z.rbを配置
*mod_rewriteは使わずに、[[さくらのレンタルサーバ非公式FAQ|http://faq.sakuratan.com/wiki/wiki.cgi?.htaccess#i21]]のとおり.htaccessを設定
*misc/plugin/google-sitemaps.rbを修正
**18行目、''?#{name.escape}''→''#{name.escape}.html''
*misc/plugin/footnote.rbを修正
**41行目、''#{@footnote_url % @footnote_index[0]}''→''\##{@footnote_name % @footnote_index[0]}''
**73行目、''#{@footnote_mark_url % fn[0]}''→''\##{@footnote_mark_name % fn[0]}''
*転送先にPerlのCGIを配置

転送先のCGIは次のとおり。

#!/usr/local/bin/perl
$wiki_path = "フルpath(最後の/は抜き)";
$wiki_cgi = "CGIファイル名";

$pathinfo = $ENV{'PATH_INFO'};
$slush = "/";
$extension = ".html";
$pointer = index ($pathinfo,$slush,1);
if ($pointer > -1){
     if ($slush eq substr($pathinfo,-1)){
         $pathinfo .= "index.html";
     }
     if ($extension ne substr($pathinfo,-5)){
         &NotFound ();
         Exit;
     }
     if( ! open FILE , "$wiki_path$pathinfo" ){
         &NotFound ();
         Exit;
     }
     print "Content-type: text/html\n\n";
     while ( $line = <FILE> ){
         print $line;
     }
     close ( FILE ) ;
     exit;
}

if ($pathinfo ne "") {
     $pathinfo = substr($pathinfo, 1);
     $pathinfo  =~ s/(.*)\..*?$/$1/;
}
$ENV{'QUERY_STRING'} = $pathinfo;
exec "$wiki_path/$wiki_cgi";
exit;

sub NotFound {
     print "Status: 404 Not Found\n";
     print "Content-type: text/html\n\n";
     print << "END_OF_HTML";
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>404 Not Found</title>
</head>
<body>
<h1>404 Not Found</h1>
<div>
<p>
ファイル"$pathinfo"はありませんよ。
</p>
</div>
</body>
</html>
END_OF_HTML
     exit;
}

!htmlヘッダ
[[天使の階段|http://www.microstory.org/gakusi/]]より[[Hikiヘッダ挿入プラグイン|http://www.microstory.org/gakusi/wiki/hiki.cgi?cmd=view&p=HikiPluginInsertHeader]]を採用。