/[pub]/suikawiki/script/misc/plugins/link/iw-wikiengine.pm
Suika

Contents of /suikawiki/script/misc/plugins/link/iw-wikiengine.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Sun May 16 23:05:49 2010 UTC (15 years, 1 month ago) by wakaba
Branch: MAIN
CVS Tags: suikawiki3-redirect, HEAD
Branch point for: helowiki-2005
Error occurred while calculating annotation data.
added latest .pm files

1 use strict;
2 package SuikaWiki::Plugin::Registry;
3
4
5 our %Info;
6 $Info{q#InterWikiForWikiEngine#}->{Name} = q#InterWikiForWikiEngine#;
7 $Info{q#InterWikiForWikiEngine#}->{q#Version#} = q#2004.0831.0328#;
8 $Info{q#InterWikiForWikiEngine#}->{q#InterfaceVersion#} = q#2.9.1#;
9 $Info{q#InterWikiForWikiEngine#}->{q#mkpluginVersion#} = q#2.1.19#;
10 $Info{q#InterWikiForWikiEngine#}->{q#module_name#} = q#SuikaWiki::Plugin::plugin::InterWikiForWikiEngine1040731032808_s0n#;
11 $Info{q#InterWikiForWikiEngine#}->{q#Date.RCS#} = q#$Date: 2004/03/10 06:57:25 $#;
12 $Info{q#InterWikiForWikiEngine#}->{RequiredPlugin} = [q#InterWikiCore#];
13 $Info{q#InterWikiForWikiEngine#}->{RequiredModule} = [q#main#, q#URI#];
14 $Info{q#InterWikiForWikiEngine#}->{Description} = [[q#InterWiki - External WikiEngine URI Reference Support#, q#en#, q##]];
15 $Info{q#InterWikiForWikiEngine#}->{License} = [[q#%%Perl%%#, q##, q##]];
16 $Info{q#InterWikiForWikiEngine#}->{Author} = [[[[q#Wakaba#, q#ja#, q#Latn#]], [[q#w@suika.fam.cx#]], [q##]]];
17 package SuikaWiki::Plugin::plugin::InterWikiForWikiEngine1040731032808_s0n;
18
19
20 #line 1 "(WikiPlugin module source iw-wikiengine.wp2, block Plugin/Use)"
21 require URI;
22 our $INTERWIKICORE;
23 #line 1 "(WikiPlugin module InterWikiForWikiEngine, chunk 1)"
24
25 $SuikaWiki::Plugin::Rule{iwc__urireference}->{suikawiki} = {q#post#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
26
27 #line 1 "(WikiPlugin module source iw-wikiengine.wp2, block FormattingRule[name()='[q#iwc--urireference#]/suikawiki']/Post)"
28 if (not $p->{version} or $p->{version} >= 2.9) {
29 $p->{-result} = $o->{wiki}->uri_reference
30 (version => $p->{version}+0,
31 wiki_uri => $p->{base} ? URI->new ($p->{base})
32 : undef,
33 page => $o->{wiki}->name ($p->{page}),
34 mode => $p->{mode},
35 up_to_date => $p->{up_to_date},
36 anchor_no => $p->{anchor_no},
37 fragment => $p->{fragment});
38 } else { # SuikaWiki 2
39 $p->{-result} = URI->new ($p->{base});
40 if (($INTERWIKICORE ||= SuikaWiki::Plugin->module_package ('InterWikiCore'))->uri_has_feature
41 (uri => $p->{-result}, method => 'query_form')) {
42 if ($p->{page} and not $p->{mode} and not $p->{up_to_date}) {
43 $p->{-result}->query (($INTERWIKICORE ||= SuikaWiki::Plugin->module_package ('InterWikiCore'))->uri_escape_encode ($p->{page}, qr([^0-9A-Za-z_.-])));
44 } else {
45 my %query;
46 $query{mypage} = $p->{page} if $p->{page};
47 $query{mycmd} = $p->{mode} if $p->{mode};
48 $query{up_to_date} = time if $p->{up_to_date};
49 $p->{-result}->query_form (%query);
50 }
51 }
52 if ($p->{anchor_no}) {
53 $p->{-result}->fragment ('anchor-'.(0+$p->{anchor_no}));
54 } elsif ($p->{fragment}) {
55 $p->{-result}->fragment ($p->{fragment});
56 }
57 }}, 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##]]}
58 #line 1 "(WikiPlugin module InterWikiForWikiEngine, chunk 2)"
59 ;
60
61 $SuikaWiki::Plugin::Rule{iwc__urireference}->{yukiwiki} = {q#post#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
62
63 #line 1 "(WikiPlugin module source iw-wikiengine.wp2, block FormattingRule[name()='[q#iwc--urireference#]/yukiwiki']/Post)"
64 $p->{-result} = URI->new ($p->{base});
65 return unless ($INTERWIKICORE ||= SuikaWiki::Plugin->module_package ('InterWikiCore'))->uri_has_feature (uri => $p->{-result},
66 method => 'query_form');
67 if (not $p->{version} or $p->{version} >= 2.0) {
68 if ($p->{mypage} and not $p->{mycmd}) {
69 $p->{mypage} = &main::code_convert (\$p->{mypage},
70 $p->{charset} || 'euc-jp');
71 $p->{-result}->query (($INTERWIKICORE ||= SuikaWiki::Plugin->module_package ('InterWikiCore'))->uri_escape_encode
72 ($p->{mypage}, qr([^0-9A-Za-z_.-])));
73 } else {
74 my %query;
75 for (qw/mypage mycmd mymsg/) {
76 $query{$_} = &main::code_convert (\$p->{$_},
77 $p->{charset} || 'euc-jp')
78 if length $p->{$_};
79 }
80 $p->{-result}->query_form (%query);
81 }
82 } else { # YukiWiki 1
83 $p->{mypage} = qq([[$p->{mypage}]])
84 if $p->{mypage} and $p->{mypage} !~ /^[A-Z][a-z]+(?:[A-Z][a-z]+)+$/;
85 my %query;
86 for (qw/mypage mycmd mymsg/) {
87 $query{$_} = &main::code_convert (\$p->{$_},
88 $p->{charset} || 'shift_jis')
89 if length $p->{$_};
90 }
91 $p->{-result}->query_form (%query);
92 }}, 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
93 to YukiWiki or derived works (such as WalWiki).
94
95 "version" parameter controls URI reference generating procedure.
96
97 In YukiWiki 1, non-alphabetical WikiName (BracketName)
98 automatically enclosed by "[[" and "]]".
99
100 In YukiWiki 2, only WikiName is used as URI query
101 when no other parameter required (ie. <http://wiki.example/?WikiName>).#, q##, q##]]}
102 #line 1 "(WikiPlugin module InterWikiForWikiEngine, chunk 4)"
103 ;
104
105 $SuikaWiki::Plugin::Rule{iwc__urireference}->{iwwe__YukiWikiDBNS_base16_encode} = {q#post#, sub {my ($f, $rule_name, $p, $o, %opt) = @_;
106
107 #line 1 "(WikiPlugin module source iw-wikiengine.wp2, block FormattingRule[name()='[q#iwc--urireference#]/iwwe__YukiWikiDBNS_base16_encode']/Post)"
108 my $c = &main::code_convert (\$p->{content}, $p->{charset} || 'euc-jp');
109 $c =~ s/(.)/sprintf '%02X', ord $1/ges;
110 $p->{wiki_namespace_delimiter} ||= $o->{wiki}->{config}->{name}->{space}
111 ->{separator};
112 $p->{wiki_namespace_delimiter} =~ s/(.)/sprintf '%02X', ord $1/ges;
113 $p->{filesystem_namespace_delimiter} ||= '/';
114 $p->{filesystem_namespace_suffix} ||= '.ns';
115 $c =~ s{$p->{wiki_namespace_delimiter}}
116 {$p->{filesystem_namespace_suffix}$p->{filesystem_namespace_delimiter}}g;
117 $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)
118 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
119 rule and suffixes.#, q#en#, q##]]}
120 #line 1 "(WikiPlugin module InterWikiForWikiEngine, chunk 6)"
121 ;
122
123 $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) = @_;
124
125 #line 1 "(WikiPlugin module source iw-wikiengine.wp2, block FormattingRule[name()='[q#link-to-resource#]/iwwe__wikiname']/Formatting)"
126 if (($INTERWIKICORE ||= SuikaWiki::Plugin->module_package ('InterWikiCore'))->uri_has_feature
127 (uri => $o->{link}->{dest}->{uri},
128 method => 'query')) {
129 my $q = $o->{link}->{dest}->{uri}->query;
130 my $page;
131 my $charset;
132 if ($q and index ($q, '=') > -1) {
133 my %q = map {split /=/, $_, 2} split /[&;]/, $q;
134 $page = $q{mypage};
135 $charset = lc ($q{_charset_} || $q{ie} || $p->{charset})
136 || $o->{wiki}->{config}->{charset}->{uri_param};
137 } elsif (defined $q and length $q) {
138 $page = $q;
139 $charset = lc $p->{charset}
140 || $o->{wiki}->{config}->{charset}->{uri_query};
141 }
142 if (defined $page) {
143 $page =~ tr/+/ /;
144 $page =~ s/%([0-9A-Fa-f][0-9A-Fa-f])/pack 'C', hex $1/ge;
145 $page = &main::code_convert (\$page, $charset);
146 $p->{-parent}->append_text ($page);
147 }
148 }}}
149 #line 1 "(WikiPlugin module InterWikiForWikiEngine, chunk 8)"
150 ;
151 package SuikaWiki::Plugin::Registry;
152
153 $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#]}};
154
155 1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24