ibis's Wiki - (Hiki)location Diff
- Added parts are displayed like this.
- Deleted parts are displayed
like this.
<{{fonts(↰,"+2")}}[[(Hiki)AuthedHiki]]>
----
この改造は Hiki 0.6.5 を対象にしています。{{br}}
ジャンプ元がばれてもかまわない場所に以下のようなCGIを設置
<<<
#!/usr/local/bin/ruby
$KCODE = 'e'
require 'cgi'
$head1 = CGI::new.header( { 'type'=>'text/html', 'charset'=>'EUC-JP' } )
$head2 = <<EOT
<html>
<body>
EOT
$tail = <<EOT
</body>
</html>
EOT
def error(msg)
print $head1
print $head2
print msg
print $tail
end
cgi = CGI.new
if cgi['url'] == nil || cgi['url'][0] == nil then
error("URLが指定されていません")
end
url = cgi['url'][0]
print $head1
print <<EOT
<html>
<head>
<meta http-equiv="Refresh" content="0;URL=#{url}">
</head>
<body>
EOT
print "0秒後に下記URLへジャンプします<br>"
print "<a href='#{url}'>#{url}</a>"
print $tail
>>>
hiki.conf に
<<<
$location_cgi = "上記CGIを設置したURL"
>>>
を追加
style/default/parser.rb の
<<<
when REF_RE
str = $'
matched = $1
if /\A(?:(.+)\|)?(.+)\z/ =~ matched
s = $1
href = $2
if URL_RE =~ href
if IMAGE_RE =~ href
h = {:e => :image, :href => href.escapeHTML}
else
h = {:e => :reference, :href => href.escapeHTML}
end
elsif /\A(.+?):(.+)\z/ =~ href
disp = s ? s : "#{$1}:#{$2}"
h = {:e => :interwiki, :href => $1, :p => $2, :s => disp }
else
h = {:e => :bracketname, :href => href}
end
h[:s] = s || href unless h.key?(:s)
@cur_stack.push( h )
end
when URL_RE
href = $&
str = $'
@cur_stack.push( {:e => :reference, :href => href, :s => href} )
>>>
のところを
<<<
when REF_RE
str = $'
matched = $1
if /\A(?:(.+)\|)?(.+)\z/ =~ matched
s = $1
href = $2
if URL_RE =~ href
if IMAGE_RE =~ href
h = {:e => :image, :href => href.escapeHTML}
else
ht = s || href
hh = "#{$location_cgi}\?url=#{href}"
h = {:e => :reference, :href => hh.escapeHTML, :s => ht}
end
elsif /\A(.+?):(.+)\z/ =~ href
disp = s ? s : "#{$1}:#{$2}"
h = {:e => :interwiki, :href => $1, :p => $2, :s => disp }
else
h = {:e => :bracketname, :href => href}
end
h[:s] = s || href unless h.key?(:s)
@cur_stack.push( h )
end
when URL_RE
href = $&
str = $'
h = "#{$location_cgi}\?url=#{href}"
# @cur_stack.push( {:e => :reference, :href => href, :s => href} )
@cur_stack.push( {:e => :reference, :href => h, :s => href} )
>>>
に変更
hiki/interwiki.rb で
<<<
@plugin.make_anchor(url, display_text)
else
@plugin.make_anchor("#{@interwiki_names[s][:url]}#{page}", display_text)
end
>>>
のところを
<<<
@plugin.make_anchor(url, display_text)
else
@plugin.make_anchor("#{$location_cgi}\?url=#{@interwiki_names[s][:url]}#{page}", display_text)
end
>>>
に変更
----
----
この改造は Hiki 0.6.5 を対象にしています。{{br}}
ジャンプ元がばれてもかまわない場所に以下のようなCGIを設置
<<<
#!/usr/local/bin/ruby
$KCODE = 'e'
require 'cgi'
$head1 = CGI::new.header( { 'type'=>'text/html', 'charset'=>'EUC-JP' } )
$head2 = <<EOT
<html>
<body>
EOT
$tail = <<EOT
</body>
</html>
EOT
def error(msg)
print $head1
print $head2
print msg
print $tail
end
cgi = CGI.new
if cgi['url'] == nil || cgi['url'][0] == nil then
error("URLが指定されていません")
end
url = cgi['url'][0]
print $head1
print <<EOT
<html>
<head>
<meta http-equiv="Refresh" content="0;URL=#{url}">
</head>
<body>
EOT
print "0秒後に下記URLへジャンプします<br>"
print "<a href='#{url}'>#{url}</a>"
print $tail
>>>
hiki.conf に
<<<
$location_cgi = "上記CGIを設置したURL"
>>>
を追加
style/default/parser.rb の
<<<
when REF_RE
str = $'
matched = $1
if /\A(?:(.+)\|)?(.+)\z/ =~ matched
s = $1
href = $2
if URL_RE =~ href
if IMAGE_RE =~ href
h = {:e => :image, :href => href.escapeHTML}
else
h = {:e => :reference, :href => href.escapeHTML}
end
elsif /\A(.+?):(.+)\z/ =~ href
disp = s ? s : "#{$1}:#{$2}"
h = {:e => :interwiki, :href => $1, :p => $2, :s => disp }
else
h = {:e => :bracketname, :href => href}
end
h[:s] = s || href unless h.key?(:s)
@cur_stack.push( h )
end
when URL_RE
href = $&
str = $'
@cur_stack.push( {:e => :reference, :href => href, :s => href} )
>>>
のところを
<<<
when REF_RE
str = $'
matched = $1
if /\A(?:(.+)\|)?(.+)\z/ =~ matched
s = $1
href = $2
if URL_RE =~ href
if IMAGE_RE =~ href
h = {:e => :image, :href => href.escapeHTML}
else
ht = s || href
hh = "#{$location_cgi}\?url=#{href}"
h = {:e => :reference, :href => hh.escapeHTML, :s => ht}
end
elsif /\A(.+?):(.+)\z/ =~ href
disp = s ? s : "#{$1}:#{$2}"
h = {:e => :interwiki, :href => $1, :p => $2, :s => disp }
else
h = {:e => :bracketname, :href => href}
end
h[:s] = s || href unless h.key?(:s)
@cur_stack.push( h )
end
when URL_RE
href = $&
str = $'
h = "#{$location_cgi}\?url=#{href}"
# @cur_stack.push( {:e => :reference, :href => href, :s => href} )
@cur_stack.push( {:e => :reference, :href => h, :s => href} )
>>>
に変更
hiki/interwiki.rb で
<<<
@plugin.make_anchor(url, display_text)
else
@plugin.make_anchor("#{@interwiki_names[s][:url]}#{page}", display_text)
end
>>>
のところを
<<<
@plugin.make_anchor(url, display_text)
else
@plugin.make_anchor("#{$location_cgi}\?url=#{@interwiki_names[s][:url]}#{page}", display_text)
end
>>>
に変更
----