/[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.2 - (hide annotations) (download)
Sun Feb 8 08:46:47 2004 UTC (21 years, 5 months ago) by wakaba
Branch: MAIN
Changes since 1.1: +2 -2 lines
New WikiName interface

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.2 @Date.RCS: $Date: 2004/02/01 12:09:44 $
17 wakaba 1.1 @RequiredModule[list]: URI
18     @RequiredPlugin[list]: InterWikiCore
19     @Use:
20     require URI;
21     our $INTERWIKICORE;
22    
23     PluginConst:
24     @INTERWIKICORE:
25     {($INTERWIKICORE ||= SuikaWiki::Plugin->module_package ('InterWikiCore'))}
26    
27    
28     FormattingRule:
29     @Category[list]: iwc--urireference
30     @Name: suikawiki
31     @Description:
32     @@@:
33     SuikaWiki URI Reference.
34     @@lang:en
35     @Parameter:
36     @@Name: anchor-no
37     @@Type: integer
38     @@Default: (none)
39     @@Description:
40     @@@: Fragment anchor number
41     @@lang:en
42     @Parameter:
43     @@Name: fragment
44     @@Type:
45     URI:fragment
46     @@Default: (none)
47     @@Description:
48     @@@: Fragment identifier
49     @@lang:en
50     @Parameter:
51     @@Name: mode
52     @@Type: mode
53     @@Default: (none)
54     @@Description:
55     @@@: Mode name.
56     @@lang: en
57     @Parameter:
58     @@Name: page
59     @@Type: WikiName
60     @@Default: (none)
61     @@Description:
62     @@@: WikiPage
63     @@lang: en
64     @Parameter:
65     @@Name: up-to-date
66     @@Type: boolean
67     @@Default: "0"
68     @@Description:
69     @@@: Whether dummy "up to date" parameter should be appended
70     @@lang:en
71     @Parameter:
72     @@Name: version
73     @@Type: number
74     @@Default: (auto)
75     @@Description:
76     @@@: Version number of SuikaWiki interface. "2.0" or "2.9".
77     @@lang: en
78     @Parameter:
79     @@Name: wiki-uri
80     @@Type: URIReference
81     @@Default: (current)
82     @@Description:
83     @@@: Base wiki URI
84     @@lang: en
85     @Post:
86     if (not $p->{version} or $p->{version} >= 2.9) {
87     $p->{-result} = $o->{wiki}->uri_reference
88     (version => $p->{version}+0,
89     wiki_uri => $p->{base} ? URI->new ($p->{base})
90     : undef,
91 wakaba 1.2 page => $o->{wiki}->name ($p->{page}),
92 wakaba 1.1 mode => $p->{mode},
93     up_to_date => $p->{up_to_date},
94     # with_lm => $p->{with_lm},
95     anchor_no => $p->{anchor_no},
96     fragment => $p->{fragment});
97     } else { # SuikaWiki 2
98     $p->{-result} = URI->new ($p->{base});
99     if ($INTERWIKICORE->uri_has_feature
100     (uri => $p->{-result}, method => 'query_form')) {
101     if ($p->{page} and not $p->{mode} and not $p->{up_to_date}) {
102     $p->{-result}->query ($INTERWIKICORE->uri_escape_encode ($p->{page}, qr([^0-9A-Za-z_.-])));
103     } else {
104     my %query;
105     $query{mypage} = $p->{page} if $p->{page};
106     $query{mycmd} = $p->{mode} if $p->{mode};
107     $query{up_to_date} = time if $p->{up_to_date};
108     $p->{-result}->query_form (%query);
109     }
110     }
111     if ($p->{anchor_no}) {
112     $p->{-result}->fragment ('anchor-'.(0+$p->{anchor_no}));
113     } elsif ($p->{fragment}) {
114     $p->{-result}->fragment ($p->{fragment});
115     }
116     }
117    
118     FormattingRule:
119     @Category[list]: iwc--urireference
120     @Name: yukiwiki
121     @Description:
122     @@@:
123     YukiWiki URI Reference. This rule can be used to specify URI reference
124     to YukiWiki or derived works (such as WalWiki).
125     \
126     "version" parameter controls URI reference generating procedure.
127     \
128     In YukiWiki 1, non-alphabetical WikiName (BracketName)
129     automatically enclosed by "[[" and "]]".
130     \
131     In YukiWiki 2, only WikiName is used as URI query
132     when no other parameter required (ie. <http://wiki.example/?WikiName>).
133     @Parameter:
134     @@Name: charset
135     @@Type: charset
136     @@Default: (auto)
137     @@Description:
138     @@@:
139     Charset in which query parameters should be encoded.
140     \
141     In YukiWiki 1, it is defaulted to "shift_jis",
142     while otherwise defaulted to "euc-jp".
143     @Parameter:
144     @@Name: mycmd
145     @@Type:
146     YukiWiki:mycmd
147     @@Default: (none)
148     @@Description:
149     @@@: YukiWiki command
150     @@lang: en
151     @Parameter:
152     @@Name: mymsg
153     @@Type: CDATA
154     @@Default: (none)
155     @@Description:
156     @@@: YukiWiki "mymsg" parameter (unescaped)
157     @@lang: en
158     @Parameter:
159     @@Name: mypage
160     @@Type:
161     YukiWiki:WikiName
162     @@Default: (none)
163     @@Description:
164     @@@: WikiPage name
165     @@lang: en
166     @Parameter:
167     @@Name: version
168     @@Type: number
169     @@Default: (auto)
170     @@Description:
171     @@@: YukiWiki version number
172     @@lang: en
173     @Post:
174     $p->{-result} = URI->new ($p->{base});
175     return unless $INTERWIKICORE->uri_has_feature (uri => $p->{-result},
176     method => 'query_form');
177     if (not $p->{version} or $p->{version} >= 2.0) {
178     if ($p->{mypage} and not $p->{mycmd}) {
179     $p->{mypage} = &main::code_convert (\$p->{mypage},
180     $p->{charset} || 'euc-jp');
181     $p->{-result}->query ($INTERWIKICORE->uri_escape_encode
182     ($p->{mypage}, qr([^0-9A-Za-z_.-])));
183     } else {
184     my %query;
185     for (qw/mypage mycmd mymsg/) {
186     $query{$_} = &main::code_convert (\$p->{$_},
187     $p->{charset} || 'euc-jp')
188     if length $p->{$_};
189     }
190     $p->{-result}->query_form (%query);
191     }
192     } else { # YukiWiki 1
193     $p->{mypage} = qq([[$p->{mypage}]])
194     if $p->{mypage} and $p->{mypage} !~ /^[A-Z][a-z]+(?:[A-Z][a-z]+)+$/;
195     my %query;
196     for (qw/mypage mycmd mymsg/) {
197     $query{$_} = &main::code_convert (\$p->{$_},
198     $p->{charset} || 'shift_jis')
199     if length $p->{$_};
200     }
201     $p->{-result}->query_form (%query);
202     }

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24