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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Sat Feb 14 10:52:13 2004 UTC (21 years, 5 months ago) by wakaba
Branch: MAIN
Changes since 1.2: +61 -2 lines
YukiWikiDBNS support

1 wakaba 1.1 #?SuikaWikiConfig/2.0
2    
3     Plugin:
4     @Name: InterWikiForWikiEngine
5     @Description:
6     @@@:
7     InterWiki - External WikiEngine URI Reference Support
8     @@lang:en
9     @License: %%GPL%%
10     @Author:
11     @@Name:
12     @@@@: Wakaba
13     @@@lang:ja
14     @@@script:Latn
15     @@Mail[list]: w@suika.fam.cx
16 wakaba 1.3 @Date.RCS: $Date: 2004/02/08 08:46:47 $
17     @RequiredModule[list]:
18     main
19     URI
20 wakaba 1.1 @RequiredPlugin[list]: InterWikiCore
21     @Use:
22     require URI;
23     our $INTERWIKICORE;
24    
25     PluginConst:
26     @INTERWIKICORE:
27     {($INTERWIKICORE ||= SuikaWiki::Plugin->module_package ('InterWikiCore'))}
28    
29    
30     FormattingRule:
31     @Category[list]: iwc--urireference
32     @Name: suikawiki
33     @Description:
34     @@@:
35     SuikaWiki URI Reference.
36     @@lang:en
37     @Parameter:
38     @@Name: anchor-no
39     @@Type: integer
40     @@Default: (none)
41     @@Description:
42     @@@: Fragment anchor number
43     @@lang:en
44     @Parameter:
45     @@Name: fragment
46     @@Type:
47     URI:fragment
48     @@Default: (none)
49     @@Description:
50     @@@: Fragment identifier
51     @@lang:en
52     @Parameter:
53     @@Name: mode
54     @@Type: mode
55     @@Default: (none)
56     @@Description:
57     @@@: Mode name.
58     @@lang: en
59     @Parameter:
60     @@Name: page
61     @@Type: WikiName
62     @@Default: (none)
63     @@Description:
64     @@@: WikiPage
65     @@lang: en
66     @Parameter:
67     @@Name: up-to-date
68     @@Type: boolean
69     @@Default: "0"
70     @@Description:
71     @@@: Whether dummy "up to date" parameter should be appended
72     @@lang:en
73     @Parameter:
74     @@Name: version
75     @@Type: number
76     @@Default: (auto)
77     @@Description:
78     @@@: Version number of SuikaWiki interface. "2.0" or "2.9".
79     @@lang: en
80     @Parameter:
81     @@Name: wiki-uri
82     @@Type: URIReference
83     @@Default: (current)
84     @@Description:
85     @@@: Base wiki URI
86     @@lang: en
87     @Post:
88     if (not $p->{version} or $p->{version} >= 2.9) {
89     $p->{-result} = $o->{wiki}->uri_reference
90     (version => $p->{version}+0,
91     wiki_uri => $p->{base} ? URI->new ($p->{base})
92     : undef,
93 wakaba 1.2 page => $o->{wiki}->name ($p->{page}),
94 wakaba 1.1 mode => $p->{mode},
95     up_to_date => $p->{up_to_date},
96     # with_lm => $p->{with_lm},
97     anchor_no => $p->{anchor_no},
98     fragment => $p->{fragment});
99     } else { # SuikaWiki 2
100     $p->{-result} = URI->new ($p->{base});
101     if ($INTERWIKICORE->uri_has_feature
102     (uri => $p->{-result}, method => 'query_form')) {
103     if ($p->{page} and not $p->{mode} and not $p->{up_to_date}) {
104     $p->{-result}->query ($INTERWIKICORE->uri_escape_encode ($p->{page}, qr([^0-9A-Za-z_.-])));
105     } else {
106     my %query;
107     $query{mypage} = $p->{page} if $p->{page};
108     $query{mycmd} = $p->{mode} if $p->{mode};
109     $query{up_to_date} = time if $p->{up_to_date};
110     $p->{-result}->query_form (%query);
111     }
112     }
113     if ($p->{anchor_no}) {
114     $p->{-result}->fragment ('anchor-'.(0+$p->{anchor_no}));
115     } elsif ($p->{fragment}) {
116     $p->{-result}->fragment ($p->{fragment});
117     }
118     }
119    
120     FormattingRule:
121     @Category[list]: iwc--urireference
122     @Name: yukiwiki
123     @Description:
124     @@@:
125     YukiWiki URI Reference. This rule can be used to specify URI reference
126     to YukiWiki or derived works (such as WalWiki).
127     \
128     "version" parameter controls URI reference generating procedure.
129     \
130     In YukiWiki 1, non-alphabetical WikiName (BracketName)
131     automatically enclosed by "[[" and "]]".
132     \
133     In YukiWiki 2, only WikiName is used as URI query
134     when no other parameter required (ie. <http://wiki.example/?WikiName>).
135     @Parameter:
136     @@Name: charset
137     @@Type: charset
138     @@Default: (auto)
139     @@Description:
140     @@@:
141     Charset in which query parameters should be encoded.
142     \
143     In YukiWiki 1, it is defaulted to "shift_jis",
144     while otherwise defaulted to "euc-jp".
145     @Parameter:
146     @@Name: mycmd
147     @@Type:
148     YukiWiki:mycmd
149     @@Default: (none)
150     @@Description:
151     @@@: YukiWiki command
152     @@lang: en
153     @Parameter:
154     @@Name: mymsg
155     @@Type: CDATA
156     @@Default: (none)
157     @@Description:
158     @@@: YukiWiki "mymsg" parameter (unescaped)
159     @@lang: en
160     @Parameter:
161     @@Name: mypage
162     @@Type:
163     YukiWiki:WikiName
164     @@Default: (none)
165     @@Description:
166     @@@: WikiPage name
167     @@lang: en
168     @Parameter:
169     @@Name: version
170     @@Type: number
171     @@Default: (auto)
172     @@Description:
173     @@@: YukiWiki version number
174     @@lang: en
175     @Post:
176     $p->{-result} = URI->new ($p->{base});
177     return unless $INTERWIKICORE->uri_has_feature (uri => $p->{-result},
178     method => 'query_form');
179     if (not $p->{version} or $p->{version} >= 2.0) {
180     if ($p->{mypage} and not $p->{mycmd}) {
181     $p->{mypage} = &main::code_convert (\$p->{mypage},
182     $p->{charset} || 'euc-jp');
183     $p->{-result}->query ($INTERWIKICORE->uri_escape_encode
184     ($p->{mypage}, qr([^0-9A-Za-z_.-])));
185     } else {
186     my %query;
187     for (qw/mypage mycmd mymsg/) {
188     $query{$_} = &main::code_convert (\$p->{$_},
189     $p->{charset} || 'euc-jp')
190     if length $p->{$_};
191     }
192     $p->{-result}->query_form (%query);
193     }
194     } else { # YukiWiki 1
195     $p->{mypage} = qq([[$p->{mypage}]])
196     if $p->{mypage} and $p->{mypage} !~ /^[A-Z][a-z]+(?:[A-Z][a-z]+)+$/;
197     my %query;
198     for (qw/mypage mycmd mymsg/) {
199     $query{$_} = &main::code_convert (\$p->{$_},
200     $p->{charset} || 'shift_jis')
201     if length $p->{$_};
202     }
203     $p->{-result}->query_form (%query);
204     }
205 wakaba 1.3
206     FormattingRule:
207     @Category[list]: iwc--urireference
208     @Name: iwwe--YukiWikiDBNS-base16-encode
209     @Description:
210     @@@:
211     String encoded in base 16 encoding, with YukiWikiDBNS namespacing
212     rule and suffixes.
213     @@lang: en
214     @Parameter:
215     @@Name: charset
216     @@Type: charset
217     @@Default: "euc-jp"
218     @@Description:
219     @@@@: Charset in which string to be encoded before base 16 applied
220     @@@lang: en
221     @Parameter:
222     @@Name: content
223     @@Type: CDATA
224     @@Default: #REQUIRED
225     @@Description:
226     @@@@: String to be encoded
227     @@@lang: en
228     @Parameter:
229     @@Name: filesystem-namespace-delimiter
230     @@Type: CDATA
231     @@Default: "/"
232     @@Description:
233     @@@@: String with which namespace components to be delimited in result
234     @@@lang: en
235     @Parameter:
236     @@Name: filesystem-namespace-suffix
237     @@Type: CDATA
238     @@Default: ".ns"
239     @@Description:
240     @@@@: String to be suffixed to namespace component in result
241     @@@lang: en
242     @Parameter:
243     @@Name: wiki-namespace-delimiter
244     @@Type: CDATA
245     @@Default: "//"
246     @@Description:
247     @@@@:
248     String by which namespace component in source ("content" parameter)
249     delimited
250     @@@lang: en
251     @Post:
252     my $c = &main::code_convert (\$p->{content}, $p->{charset} || 'euc-jp');
253     $c =~ s/(.)/sprintf '%02X', ord $1/ges;
254     $p->{wiki_namespace_delimiter} ||= $o->{wiki}->{config}->{name}->{space}
255     ->{separator};
256     $p->{wiki_namespace_delimiter} =~ s/(.)/sprintf '%02X', ord $1/ges;
257     $p->{filesystem_namespace_delimiter} ||= '/';
258     $p->{filesystem_namespace_suffix} ||= '.ns';
259     $c =~ s{$p->{wiki_namespace_delimiter}}
260     {$p->{filesystem_namespace_suffix}$p->{filesystem_namespace_delimiter}}g;
261     $p->{-result} .= $c . ($p->{filesystem_file_suffix} || '.txt');

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24