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

Hiki変更点

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

転送先の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;
}
Last modified:2010/05/03 23:39:04
Keyword(s):
References:[メモリーズオフ]
This page is frozen.