From: Masatoshi SEKI Date: 2000-08-19T02:08:10+09:00 Subject: [ruby-list:24271] Tiki, ruby-1.4.6 咳といいます。 1.4.6 の Ruby で Wiki Clone の Tiki 1.0.3 を試してみました。 やっぱり module_function でエラーが出てしまいました。 残念。 # Wiki Clone に触るのは Swiki に続いて二つめ。 # Tiki Clone を作ってみようかな。 以下パッチ --- tiki.cgi Sat Aug 19 01:53:11 2000 +++ /home/mas/public_html/tiki/cgi-bin/tiki.cgi Sat Aug 19 01:46:36 2000 @@ -7,10 +7,12 @@ def initialize(name) @name = name; end - def splitword(name) + def Page.splitword(name) name.gsub("([a-z])([A-Z])", '\1 \2'); end - module_function :splitword + def splitword(name) + Page.splitword(name) + end def pageparam(name, content) { '%K;'=>dohtmlescape(splitword(name)), '%W;'=>dohtmlescape(name), '%E;'=>CGI::escape(name), '%C;'=>content, '%U;'=>$CGIURL, '%T;'=>$TITLE, '%TOP;'=>$TOPPAGENAME, '%HELP;'=>$HELPPAGENAME, '%LOGO;'=>$LOGO,'%LOGOURL;'=>$LOGOURL, '%PAGECONFIG;'=>$PAGECONFIG, '%ROWS;'=>$EDITROWS, '%COLS;'=>$EDITCOLS, '%RECENT;'=>$RECENTPAGENAME, '%META;'=>$METATAGS, '%LAST;'=>$repository.lastmodified(name) } end @@ -77,14 +79,18 @@ $repository.store(@name, content, 'A'); show end - def dohtmlunescape(p) + def Page.dohtmlunescape(p) p.gsub($pat_htmlunescape) { $htmlunescape.fetch($1); } end - def dohtmlescape(p) + def dohtmlunescape(p) + Page.dohtmlunescape(p) + end + def Page.dohtmlescape(p) p.gsub($pat_htmlescape) { $htmlescape.fetch($1); } end - module_function :dohtmlescape - module_function :dohtmlunescape + def dohtmlescape(p) + Page.dohtmlescape(p) + end def find(word, regexp, casefold) begin fl = ["
" + dohtmlescape(word) + "
"]; @@ -214,15 +220,19 @@ def initialize(content) @content = content; end - def pagehref(s) # receivs after htmlescaped name + def PageFormatter.pagehref(s) # receivs after htmlescaped name u = Page::dohtmlunescape(s); ($repository.isexist(u)) ? "" + Page::splitword(s) + "" : s + "" + $notexistmark + "" ; end - def filehref(s) + def pagehref(s) + PageFormatter.pagehref(s) + end + def PageFormatter.filehref(s) "" + Page::dohtmlescape(Page::splitword(CGI::unescape(s))) + ""; end - module_function :pagehref - module_function :filehref + def filehref(s) + PageFormatter.filehref(s) + end def replace(line) line = line.gsub($pat_htmlescape) { s = $1; (@pre == 1) ? s: (((val = $htmlescape.fetch(s)) == nil) ? s: val); } line.gsub!($pat_table) { $tabletags.fetch($1) }