use strict; package SuikaWiki::Plugin::Registry; our %Info; $Info{q#InterWikiForWikiEngine#}->{Name} = q#InterWikiForWikiEngine#; $Info{q#InterWikiForWikiEngine#}->{q#Version#} = q#2004.0831.0328#; $Info{q#InterWikiForWikiEngine#}->{q#InterfaceVersion#} = q#2.9.1#; $Info{q#InterWikiForWikiEngine#}->{q#mkpluginVersion#} = q#2.1.19#; $Info{q#InterWikiForWikiEngine#}->{q#module_name#} = q#SuikaWiki::Plugin::plugin::InterWikiForWikiEngine1040731032808_s0n#; $Info{q#InterWikiForWikiEngine#}->{q#Date.RCS#} = q#$Date: 2010/05/16 23:05:49 $#; $Info{q#InterWikiForWikiEngine#}->{RequiredPlugin} = [q#InterWikiCore#]; $Info{q#InterWikiForWikiEngine#}->{RequiredModule} = [q#main#, q#URI#]; $Info{q#InterWikiForWikiEngine#}->{Description} = [[q#InterWiki - External WikiEngine URI Reference Support#, q#en#, q##]]; $Info{q#InterWikiForWikiEngine#}->{License} = [[q#%%Perl%%#, q##, q##]]; $Info{q#InterWikiForWikiEngine#}->{Author} = [[[[q#Wakaba#, q#ja#, q#Latn#]], [[q#w@suika.fam.cx#]], [q##]]]; package SuikaWiki::Plugin::plugin::InterWikiForWikiEngine1040731032808_s0n; #line 1 "(WikiPlugin module source iw-wikiengine.wp2, block Plugin/Use)" require URI; our $INTERWIKICORE; #line 1 "(WikiPlugin module InterWikiForWikiEngine, chunk 1)" $SuikaWiki::Plugin::Rule{iwc__urireference}->{suikawiki} = {q#post#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source iw-wikiengine.wp2, block FormattingRule[name()='[q#iwc--urireference#]/suikawiki']/Post)" if (not $p->{version} or $p->{version} >= 2.9) { $p->{-result} = $o->{wiki}->uri_reference (version => $p->{version}+0, wiki_uri => $p->{base} ? URI->new ($p->{base}) : undef, page => $o->{wiki}->name ($p->{page}), mode => $p->{mode}, up_to_date => $p->{up_to_date}, anchor_no => $p->{anchor_no}, fragment => $p->{fragment}); } else { # SuikaWiki 2 $p->{-result} = URI->new ($p->{base}); if (($INTERWIKICORE ||= SuikaWiki::Plugin->module_package ('InterWikiCore'))->uri_has_feature (uri => $p->{-result}, method => 'query_form')) { if ($p->{page} and not $p->{mode} and not $p->{up_to_date}) { $p->{-result}->query (($INTERWIKICORE ||= SuikaWiki::Plugin->module_package ('InterWikiCore'))->uri_escape_encode ($p->{page}, qr([^0-9A-Za-z_.-]))); } else { my %query; $query{mypage} = $p->{page} if $p->{page}; $query{mycmd} = $p->{mode} if $p->{mode}; $query{up_to_date} = time if $p->{up_to_date}; $p->{-result}->query_form (%query); } } if ($p->{anchor_no}) { $p->{-result}->fragment ('anchor-'.(0+$p->{anchor_no})); } elsif ($p->{fragment}) { $p->{-result}->fragment ($p->{fragment}); } }}, q#Parameter#, {q#page#, {q#Type#, q#WikiName#, q#Default#, q#(none)#, q#Description#, [[q##, q##, q##]]}, q#version#, {q#Type#, q#number#, q#Default#, q#(auto)#, q#Description#, [[q##, q##, q##]]}, q#up_to-date#, {q#Type#, q#boolean#, q#Default#, q#"0"#, q#Description#, [[q##, q##, q##]]}, q#mode#, {q#Type#, q#mode#, q#Default#, q#(none)#, q#Description#, [[q##, q##, q##]]}, q#fragment#, {q#Type#, q#URI:fragment#, q#Default#, q#(none)#, q#Description#, [[q##, q##, q##]]}, q#wiki_uri#, {q#Type#, q#URIReference#, q#Default#, q#(current)#, q#Description#, [[q##, q##, q##]]}, q#anchor_no#, {q#Type#, q#integer#, q#Default#, q#(none)#, q#Description#, [[q##, q##, q##]]}}, q#Description#, [[q#SuikaWiki URI Reference.#, q#en#, q##]]} #line 1 "(WikiPlugin module InterWikiForWikiEngine, chunk 2)" ; $SuikaWiki::Plugin::Rule{iwc__urireference}->{yukiwiki} = {q#post#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source iw-wikiengine.wp2, block FormattingRule[name()='[q#iwc--urireference#]/yukiwiki']/Post)" $p->{-result} = URI->new ($p->{base}); return unless ($INTERWIKICORE ||= SuikaWiki::Plugin->module_package ('InterWikiCore'))->uri_has_feature (uri => $p->{-result}, method => 'query_form'); if (not $p->{version} or $p->{version} >= 2.0) { if ($p->{mypage} and not $p->{mycmd}) { $p->{mypage} = &main::code_convert (\$p->{mypage}, $p->{charset} || 'euc-jp'); $p->{-result}->query (($INTERWIKICORE ||= SuikaWiki::Plugin->module_package ('InterWikiCore'))->uri_escape_encode ($p->{mypage}, qr([^0-9A-Za-z_.-]))); } else { my %query; for (qw/mypage mycmd mymsg/) { $query{$_} = &main::code_convert (\$p->{$_}, $p->{charset} || 'euc-jp') if length $p->{$_}; } $p->{-result}->query_form (%query); } } else { # YukiWiki 1 $p->{mypage} = qq([[$p->{mypage}]]) if $p->{mypage} and $p->{mypage} !~ /^[A-Z][a-z]+(?:[A-Z][a-z]+)+$/; my %query; for (qw/mypage mycmd mymsg/) { $query{$_} = &main::code_convert (\$p->{$_}, $p->{charset} || 'shift_jis') if length $p->{$_}; } $p->{-result}->query_form (%query); }}, q#Parameter#, {q#mypage#, {q#Type#, q#YukiWiki:WikiName#, q#Default#, q#(none)#, q#Description#, [[q##, q##, q##]]}, q#version#, {q#Type#, q#number#, q#Default#, q#(auto)#, q#Description#, [[q##, q##, q##]]}, q#mymsg#, {q#Type#, q#CDATA#, q#Default#, q#(none)#, q#Description#, [[q##, q##, q##]]}, q#mycmd#, {q#Type#, q#YukiWiki:mycmd#, q#Default#, q#(none)#, q#Description#, [[q##, q##, q##]]}, q#charset#, {q#Type#, q#charset#, q#Default#, q#(auto)#, q#Description#, [[q##, q##, q##]]}}, q#Description#, [[q#YukiWiki URI Reference. This rule can be used to specify URI reference to YukiWiki or derived works (such as WalWiki). "version" parameter controls URI reference generating procedure. In YukiWiki 1, non-alphabetical WikiName (BracketName) automatically enclosed by "[[" and "]]". In YukiWiki 2, only WikiName is used as URI query when no other parameter required (ie. ).#, q##, q##]]} #line 1 "(WikiPlugin module InterWikiForWikiEngine, chunk 4)" ; $SuikaWiki::Plugin::Rule{iwc__urireference}->{iwwe__YukiWikiDBNS_base16_encode} = {q#post#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source iw-wikiengine.wp2, block FormattingRule[name()='[q#iwc--urireference#]/iwwe__YukiWikiDBNS_base16_encode']/Post)" my $c = &main::code_convert (\$p->{content}, $p->{charset} || 'euc-jp'); $c =~ s/(.)/sprintf '%02X', ord $1/ges; $p->{wiki_namespace_delimiter} ||= $o->{wiki}->{config}->{name}->{space} ->{separator}; $p->{wiki_namespace_delimiter} =~ s/(.)/sprintf '%02X', ord $1/ges; $p->{filesystem_namespace_delimiter} ||= '/'; $p->{filesystem_namespace_suffix} ||= '.ns'; $c =~ s{$p->{wiki_namespace_delimiter}} {$p->{filesystem_namespace_suffix}$p->{filesystem_namespace_delimiter}}g; $p->{-result} .= $c . ($p->{filesystem_file_suffix} || '.txt');}, q#Parameter#, {q#wiki_namespace-delimiter#, {q#Type#, q#CDATA#, q#Default#, q#"//"#, q#Description#, [[q#String by which namespace component in source ("content" parameter) delimited#, q#en #, q##]]}, q#filesystem_namespace-suffix#, {q#Type#, q#CDATA#, q#Default#, q#".ns"#, q#Description#, [[q#String to be suffixed to namespace component in result#, q#en#, q##]]}, q#filesystem_namespace-delimiter#, {q#Type#, q#CDATA#, q#Default#, q#"/"#, q#Description#, [[q#String with which namespace components to be delimited in result#, q#en#, q##]]}, q#content#, {q#Type#, q#CDATA#, q#Default#, q#\#REQUIRED#, q#Description#, [[q#String to be encoded#, q#en#, q##]]}, q#charset#, {q#Type#, q#charset#, q#Default#, q#"euc-jp"#, q#Description#, [[q#Charset in which string to be encoded before base 16 applied#, q#en#, q##]]}}, q#Description#, [[q#String encoded in base 16 encoding, with YukiWikiDBNS namespacing rule and suffixes.#, q#en#, q##]]} #line 1 "(WikiPlugin module InterWikiForWikiEngine, chunk 6)" ; $SuikaWiki::Plugin::Rule{link_to_resource}->{iwwe__wikiname} = {q#Parameter#, {q#charset#, {q#Type#, q#charset#, q#Default#, q#(auto)#, q#Description#, [[q##, q##, q##]]}}, q#Description#, [[q#Extracting WikiName from URI reference#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source iw-wikiengine.wp2, block FormattingRule[name()='[q#link-to-resource#]/iwwe__wikiname']/Formatting)" if (($INTERWIKICORE ||= SuikaWiki::Plugin->module_package ('InterWikiCore'))->uri_has_feature (uri => $o->{link}->{dest}->{uri}, method => 'query')) { my $q = $o->{link}->{dest}->{uri}->query; my $page; my $charset; if ($q and index ($q, '=') > -1) { my %q = map {split /=/, $_, 2} split /[&;]/, $q; $page = $q{mypage}; $charset = lc ($q{_charset_} || $q{ie} || $p->{charset}) || $o->{wiki}->{config}->{charset}->{uri_param}; } elsif (defined $q and length $q) { $page = $q; $charset = lc $p->{charset} || $o->{wiki}->{config}->{charset}->{uri_query}; } if (defined $page) { $page =~ tr/+/ /; $page =~ s/%([0-9A-Fa-f][0-9A-Fa-f])/pack 'C', hex $1/ge; $page = &main::code_convert (\$page, $charset); $p->{-parent}->append_text ($page); } }}} #line 1 "(WikiPlugin module InterWikiForWikiEngine, chunk 8)" ; package SuikaWiki::Plugin::Registry; $Info{q#InterWikiForWikiEngine#}->{provide} = {q#rule#, {q#link_to_resource#, [q#iwwe__wikiname#], q#iwc__urireference#, [q#suikawiki#, q#yukiwiki#, q#iwwe__YukiWikiDBNS_base16_encode#]}}; 1;