/[pub]/suikawiki/script/lib/SuikaWiki/Plugin/WikiLinking.wp2
Suika

Contents of /suikawiki/script/lib/SuikaWiki/Plugin/WikiLinking.wp2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (hide annotations) (download)
Thu Mar 11 10:12:39 2004 UTC (22 years, 3 months ago) by wakaba
Branch: MAIN
Changes since 1.9: +3 -1 lines
Don't raise error even if SuikaWikiConst09 module not loaded

1 wakaba 1.1 #?SuikaWikiConfig/2.0
2    
3     Plugin:
4     @Name: WikiLinking
5     @Description:
6     @@@: Wiki hyperlinking support
7     @@lang:en
8 wakaba 1.7 @License: %%Perl%%
9 wakaba 1.1 @Author:
10     @@Name:
11     @@@@: Wakaba
12     @@@lang:ja
13     @@@script:Latn
14     @@Mail[list]: w@suika.fam.cx
15 wakaba 1.7 @Date.RCS:
16 wakaba 1.10 $Date: 2004/03/11 08:05:38 $
17 wakaba 1.2 @Use:
18     use Message::Util::Error;
19     our $NestLevel = 0;
20 wakaba 1.7 my $WIKIRESOURCE;
21     my $ERROR;
22 wakaba 1.1
23     PluginConst:
24     @NS_XHTML1:
25     http://www.w3.org/1999/xhtml
26     @NS_XHTML2:
27     http://www.w3.org/2002/06/xhtml2
28     @NS_XLINK:
29     http://www.w3.org/1999/xlink
30     @NS_HLINK:
31     http://www.w3.org/2002/06/hlink
32 wakaba 1.7 @ERROR:
33     {($ERROR ||= SuikaWiki::Plugin->module_package ('Error'))}
34     @WIKIRESOURCE:
35     {($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))}
36 wakaba 1.1
37     FormattingRule:
38     @Category[list]:
39     view
40     view-resource
41     form-input
42     @Name: link-to-wikipage
43     @Description:
44     @@@:
45     Creating "from" anchor field of a link whose "to" is a WikiPage
46     @@lang: en
47     @Parameter:
48     @@Name: base-page
49     @@Type: WikiName
50     @@Default: (current)
51     @@Description:
52     @@@@:Base WikiName (Relative WikiName is resolved with)
53     @@@lang:en
54     @Parameter:
55     @@Name: hreflang
56     @@Type:
57     HTML4:LanguageCode
58     @@Default:(none)
59     @@Description:
60     @@@@:(Human) language the linked WikiPage written in
61     @@@lang:en
62     @Parameter:
63     @@Name: hreftype
64     @@Type:
65     HTML4:ContentType
66     @@Default:(none)
67     @@Description:
68     @@@@:Media type the linked WikiPage provided with
69     @@@lang:en
70     @Parameter:
71     @@Name:label
72     @@Type:CDATA
73     @@Default:(auto)
74     @@Description:
75     @@@@:Source anchor label
76     @@@lang:en
77     @Parameter:
78     @@Name: mode
79     @@Type: WikiMode
80     @@Default:(default)
81     @@Description:
82     @@@@:Mode of the Wiki linked to
83     @@@lang:en
84     @Parameter:
85     @@Name: page
86     @@Type: WikiName
87     @@Default: (current)
88     @@Description:
89     @@@@:WikiPage linked to
90     @@@lang:en
91     @Parameter:
92     @@Name: page-anchor-name
93     @@Type:
94     XML:ID
95     @@Default: (none)
96     @@Description:
97     @@@@:Identifier in the WikiPage linked to
98     @@@lang:en
99     @Parameter:
100     @@Name: page-anchor-no
101     @@Type:
102     SGML:NUMBER
103     @@Default: (none)
104     @@Description:
105     @@@@:Numeral anchor index in the WikiPage linked to
106     @@@lang:en
107     @Parameter:
108     @@Name: page-title
109     @@Type:CDATA
110     @@Default:(auto)
111     @@Description:
112     @@@@:Title of the WikiPage linked to
113     @@@lang:en
114     @Parameter:
115     @@Name: rel
116     @@Type:
117     HTML4:LinkTypes
118     @@Default:(none)
119     @@Description:
120     @@@@:Link relationships
121     @@@lang:en
122     @Parameter:
123     @@Name: rev
124     @@Type:
125     HTML4:LinkTypes
126     @@Default:(none)
127     @@Description:
128     @@@@:Link relationship (reverse)
129     @@@lang:en
130     @Parameter:
131     @@Name: up-to-date
132     @@Type: boolean
133     @@Default: "0"
134     @@Description:
135     @@@@:Appends random "up-to-date" parameter to the URI reference
136     @@@lang:en
137     @Parameter:
138     @@Name: with-lm
139     @@Type: boolean
140     @@Default:"0"
141     @@Description:
142     @@@@:Appends "last-modified" parameter to the URI reference
143     @@@lang:en
144     @Formatting:
145     __ATTRNODE:%page_title__;
146     __ATTRTEXT:%class__;
147 wakaba 1.2 __ATTRTEXT:%label__;
148 wakaba 1.1 __ATTRTEXT:%page__;__ATTRTEXT:%base_page__;__ATTRTEXT:%page_anchor_no__;
149     __ATTRTEXT:%with_lm__;__ATTRTEXT:%up_to_date__;
150     __ATTRTEXT:%page_anchor_name__;
151     __ATTRTEXT:%hreflang__;__ATTRTEXT:%hreftype__;
152     __ATTRTEXT:%mode__;
153     __ATTRTEXT:%rel__;__ATTRTEXT:%rev__;
154     __FUNCPACK__->to_wikipage_in_html ({
155 wakaba 1.6 label => $p->{label},
156 wakaba 1.1 } => {
157 wakaba 1.6 base => $o->{wiki}->name ($p->{base_page} ||
158     $o->{wiki}->{var}->{page}),
159     page_name_relative => $o->{wiki}->name ($p->{page} ||
160     $o->{wiki}->{var}->{page}),
161     page_anchor_no => $p->{page_anchor_no},
162 wakaba 1.1 page_anchor_name => $p->{page_anchor_name},
163 wakaba 1.6 page_title => $p->{page_title},
164     wiki_mode => $p->{mode},
165     _with_lm => $p->{with_lm},
166     _up_to_date => $p->{up_to_date},
167     -hreflang => $p->{hreflang},
168     -hreftype => $p->{type},
169 wakaba 1.1 }, {
170 wakaba 1.6 o => $o,
171     parent => $p->{-parent},
172     -rel => $p->{rel},
173     -rev => $p->{rev},
174 wakaba 1.1 });
175    
176     FormattingRule:
177 wakaba 1.3 @Category[list]:
178     view
179     view-resource
180     form-input
181     @Name: link-to-resource
182     @Description:
183     @@@:
184     Creating source anchor field of a link whose destination is a resource
185     @@lang: en
186     @Parameter
187     @@Name: hreflang
188     @@Type:
189     HTML4:LanguageCode
190     @@Default:(none)
191     @@Description:
192     @@@@:(Human) language the linked WikiPage written in (advisory)
193     @@@lang:en
194     @Parameter:
195     @@Name: hreftype
196     @@Type:
197     HTML4:ContentType
198     @@Default:(none)
199     @@Description:
200     @@@@:Media type the linked WikiPage provided with (advisory)
201     @@@lang:en
202     @Parameter:
203     @@Name:label
204     @@Type:CDATA
205     @@Default:(auto)
206     @@Description:
207     @@@@:Source anchor label
208     @@@lang:en
209     @Parameter:
210     @@Name: rel
211     @@Type:
212     HTML4:LinkTypes
213     @@Default:(none)
214     @@Description:
215     @@@@:Link relationships
216     @@@lang:en
217     @Parameter:
218     @@Name: rev
219     @@Type:
220     HTML4:LinkTypes
221     @@Default:(none)
222     @@Description:
223     @@@@:Link relationship (reverse)
224     @@@lang:en
225     @Parameter:
226     @@Name: uri
227     @@Type:
228     HTML4:URI
229     @@Default:(required)
230     @@Description:
231     @@@@:URI reference of the resoruce referred to
232     @@@lang:en
233     @Formatting:
234     __ATTRTEXT:%class__;
235     __ATTRTEXT:%label__;
236     __ATTRTEXT:%hreflang__;__ATTRTEXT:%hreftype__;
237     __ATTRTEXT:%rel__;__ATTRTEXT:%rev__;
238     __ATTRTEXT:%uri__;
239 wakaba 1.7 my $src = {
240 wakaba 1.6 label => $p->{label},
241 wakaba 1.7 };
242     my $dest = {
243 wakaba 1.3 -hreflang => $p->{hreflang},
244     -hreftype => $p->{type},
245 wakaba 1.7 };
246     my $opt = {
247 wakaba 1.3 o => $o,
248     parent => $p->{-parent},
249     -rel => $p->{rel},
250     -rev => $p->{rev},
251 wakaba 1.7 };
252     if (length $p->{uri}) {
253     $dest->{uri} = $p->{uri};
254     } else {
255     __ATTRTEXT:%iw_name__;
256     if ($p->{iw_name}) {
257     __ATTRTEXT:%iw_parameter__;
258     $dest->{resource_scheme} = 'IW';
259     $dest->{resource_parameter} = undef;
260     $dest->{-iw__name} = $p->{iw_name};
261     $dest->{-iw__parameter} = $p->{iw_parameter};
262     __FUNCPACK__->to_resource_in_html ($src => $dest, $opt);
263     return;
264     } else {
265     $dest->{uri} = q<>;
266     }
267     }
268     __FUNCPACK__->to_resource_by_uri_in_html ($src => $dest, $opt);
269 wakaba 1.3
270     FormattingRule:
271     @Category[list]:
272     page-link
273     link-to-resource
274 wakaba 1.1 @Name: link-to-it
275     @Description:
276     @@@:
277     Source anchor
278     @@lang: en
279     @Parameter:
280     @@Name: class
281     @@Type:
282     HTML4:class
283     @@Default: (none)
284     @@Description:
285     @@@@: Class names
286     @@@lang:en
287     @Parameter:
288     @@Name: description
289     @@Type: CDATA
290     @@Default: (none)
291     @@Description:
292     @@@@: Description of the anchor or link
293     @@@lang:en
294     @Parameter:
295     @@Name: label
296     @@Type: CDATA
297     @@Default: ""
298     @@Description:
299     @@@@: Source anchor label (content)
300     @@@lang:en
301     @Formatting:
302     __ATTRTEXT:%class__;
303     my $A = $p->{-parent}->append_new_node (type => '#element',
304     namespace_uri => $NS_XHTML1,
305     local_name => 'a');
306     $A->set_attribute (href => $o->{link}->{dest}->{uri});
307    
308 wakaba 1.2 __ATTRNODE:%label->{$A}__;
309 wakaba 1.7 if (length $p->{description}) {
310     __ATTRTEXT:%description__;
311     } else {
312     if ($f->{-category_name} eq 'page_link') {
313     $p->{description} = $WIKIRESOURCE->get
314     (name => 'WikiLinking:LinkToIt:ToWikiPage:Description',
315     o => $o, wiki => $o->{wiki},
316     formatter_context => $f->{-category_name},
317     formatter_option => {param => $o})->inner_text;
318     } else {
319     $p->{description} = $WIKIRESOURCE->get
320     (name => 'WikiLinking:LinkToIt:ToResource:Description',
321     o => $o, wiki => $o->{wiki},
322     formatter_context => $f->{-category_name},
323     formatter_option => {param => $o})->inner_text;
324     }
325     }
326 wakaba 1.1 $A->set_attribute (title => $p->{description}) if $p->{description};
327     my @class = split /\s+/, $p->{class};
328 wakaba 1.3 if ($o->{wiki}->uri_is_part_of_wiki ($o->{link}->{dest}->{absolute_uri} or
329     $o->{link}->{dest}->{uri})) {
330 wakaba 1.1 push @class, 'wiki'; ## Link to the page within the Wiki
331     }
332     $A->set_attribute (class => join ' ', @class) if @class;
333    
334     $A->set_attribute (rel => $o->{link}->{option}->{-rel})
335     if $o->{link}->{option}->{-rel};
336     $A->set_attribute (rev => $o->{link}->{option}->{-rev})
337     if $o->{link}->{option}->{-rev};
338    
339     $A->set_attribute (hreflang => $o->{link}->{dest}->{-lang})
340     if $o->{link}->{dest}->{-lang};
341     $A->set_attribute (type => $o->{link}->{dest}->{-type})
342     if $o->{link}->{dest}->{-type};
343    
344     FormattingRule:
345 wakaba 1.3 @Category[list]:
346     page-link
347     link-to-resource
348     @Name: uri-reference
349     @Description:
350     @@@: URI Reference of destination anchor
351     @@lang:en
352     @Formatting:
353     $p->{-parent}->append_text ($o->{link}->{dest}->{absolute_uri} or
354     $o->{link}->{dest}->{uri});
355    
356     FormattingRule:
357     @Category[list]: link-to-resource
358     @Name: link-resource-scheme
359     @Description:
360     @@@: Linking scheme (defined as ReferenceScheme in SuikaWiki/0.9 syntax)
361     @@lang:en
362     @Formatting:
363     $p->{-parent}->append_text ($o->{link}->{dest}->{resource_scheme});
364    
365     FormattingRule:
366     @Category[list]: link-to-resource
367     @Name: link-resource-parameters
368     @Description:
369     @@@: Linking parameters (defined as ReferenceParameter in SuikaWiki/0.9 syntax)
370     @@lang:en
371     @Formatting:
372     $p->{-parent}->append_text ($o->{link}->{dest}->{resource_parameter});
373    
374     FormattingRule:
375 wakaba 1.1 @Category[list]: page-link
376     @Name: link-base-page-name
377     @Description:
378     @@@: Base WikiPage name
379     @@lang: en
380     @Formatting:
381 wakaba 1.6 $p->{-parent}->append_text
382     ($o->{link}->{dest}->{base}->stringify (wiki => $o->{wiki}));
383 wakaba 1.1
384     FormattingRule:
385     @Category[list]: page-link
386     @Name: link-dest-anchor-no
387     @Description:
388     @@@: Anchor number in the WikiPage linked to, if specified
389     @@lang: en
390     @Formatting:
391     $p->{-parent}->append_text ($o->{link}->{dest}->{page_anchor_no});
392    
393     FormattingRule:
394 wakaba 1.3 @Category[list]: link-to-resource
395     @Name: if-link-resource-scheme
396     @Description:
397     @@@: If or if not resource pointing scheme matches to
398     @@lang:en
399     @Parameter:
400     @@Name: name
401     @@Type:
402     SW09:name
403     @@Default:(required)
404     @@Description:
405     @@@@: Scheme name
406     @@@lang:en
407     @Formatting:
408     __ATTRTEXT:%name__;
409     my $rule;
410     if ($o->{link}->{dest}->{resource_scheme} eq $p->{name}) {
411     $rule = __ATTRTEXT:%true__;
412     } else {
413     $rule = __ATTRTEXT:%false__;
414     }
415     SuikaWiki::Plugin->formatter ($f->{-category_name})
416     ->replace ($rule, param => $o, -parent => $p->{-parent});
417    
418     FormattingRule:
419     @Category[list]: link-to-resource
420     @Name: select-link-resource-scheme
421     @Description:
422     @@@: Selecting template by resource pointing scheme matches to
423     @@lang:en
424     @Parameter:
425     @@Name: SCHEMENAME
426     @@Type:
427     template
428     @@Default:(none)
429     @@Description:
430     @@@@: Template used when scheme name is SCHEMENAME
431     @@@lang:en
432     @Parameter:
433     @@Name: otherwise
434     @@Type:
435     template
436     @@Default:(none)
437     @@Description:
438     @@@@: Template used when no SCHEMENAME parameter matches
439     @@@lang:en
440     @Formatting:
441     my $rule;
442     if (defined $p->{$o->{link}->{dest}->{resource_scheme}}) {
443     $rule = __ATTRTEXT:%{$o->{link}->{dest}->{resource_scheme}}__;
444     } else {
445     $rule = __ATTRTEXT:%otherwise__;
446     }
447     SuikaWiki::Plugin->formatter ($f->{-category_name})
448     ->replace ($rule, param => $o, -parent => $p->{-parent});
449    
450     FormattingRule:
451 wakaba 1.1 @Category[list]: page-link
452     @Name: if-linked-wikipage-exist
453     @Description:
454     @@@: If or if not linked WikiPage exists, then
455     @@lang: en
456     @Formatting:
457 wakaba 1.2 my $page = $o->{link}->{dest}->{page_name};
458 wakaba 1.1 my $rule;
459 wakaba 1.8 my $exists = 0;
460     if ($o->{wiki}->{db}) {
461     try {
462     $exists = $o->{wiki}->{db}->exist (content => $page);
463     } catch SuikaWiki::DB::Util::Error with {
464     my $err = shift;
465     $err->throw if $err->{-type} eq 'ERROR_REPORTED';
466     };
467     }else {CORE::die Carp::longmess}
468 wakaba 1.5 if ($exists) {
469 wakaba 1.1 $rule = __ATTRTEXT:%true__;
470     } else {
471     $rule = __ATTRTEXT:%false__;
472     }
473 wakaba 1.5 SuikaWiki::Plugin->formatter ('page_link')
474 wakaba 1.1 ->replace ($rule, param => $o, -parent => $p->{-parent});
475    
476     FormattingRule:
477     @Category[list]: page-link
478     @Name: if-link-has-dest-anchor-no
479     @Description:
480     @@@: If or if the link has destination numeral anchor
481     @@lang: en
482     @Formatting:
483     my $rule;
484     if ($o->{link}->{dest}->{page_anchor_no}) {
485     $rule = __ATTRTEXT:%true__;
486     } else {
487     $rule = __ATTRTEXT:%false__;
488     }
489     SuikaWiki::Plugin->formatter ('page-link')
490     ->replace ($rule, param => $o, -parent => $p->{-parent});
491    
492     FormattingRule:
493 wakaba 1.3 @Category[list]:
494     page-link
495     link-to-resource
496 wakaba 1.1 @Name:-bare-text
497     @Formatting:
498     $p->{-parent}->append_text ($p->{-bare_text});
499    
500     Function:
501 wakaba 1.3 @Name: to_resource_in_html
502     @Description:
503     @@@Make a link to the resource (outputted in HTML)
504     @@lang:en
505     @Main:
506     my (undef, $src => $dest, $opt) = @_;
507     if ($dest->{resource_scheme} eq 'URI' or
508     $dest->{resource_scheme} eq 'URL') {
509 wakaba 1.7 $dest->{uri} = URI->new ($dest->{resource_parameter});
510 wakaba 1.3 } elsif ($dest->{resource_scheme} eq 'IW') {
511 wakaba 1.5 $dest->{uri} = SuikaWiki::Plugin->module_package ('InterWikiCore')
512 wakaba 1.3 ->interwikireference_to_urireference
513 wakaba 1.5 (packed => $dest->{resource_parameter},
514 wakaba 1.7 name => $dest->{-iw__name},
515     param => $dest->{-iw__parameter},
516 wakaba 1.5 o => $opt->{o},
517 wakaba 1.7 wiki => $opt->{o}->{wiki})
518     || URI->new (q<#err--error>);
519 wakaba 1.3 } elsif ($dest->{resource_scheme} eq 'MAIL') {
520     $dest->{uri} = 'mailto:'.$dest->{resource_parameter};
521     } else {
522 wakaba 1.7 $ERROR->report_error_simple
523     ($opt->{o}->{wiki},
524     $WIKIRESOURCE->get_op ('Error:Condition', $opt->{o})
525     => $WIKIRESOURCE->get_op
526     ('WikiLinking:ResourceScheme:Unknown:Description',
527     $opt->{o}),
528     $WIKIRESOURCE->get_op ('WikiLinking:ResourceScheme', $opt->{o})
529     => $dest->{resource_scheme},
530     $WIKIRESOURCE->get_op ('WikiLinking:ResourceParameter',
531     $opt->{o})
532     => $dest->{resource_parameter},
533     );
534     $dest->{uri} = URI->new (q<#err--error>);
535 wakaba 1.3 }
536     __FUNCPACK__->to_resource_by_uri_in_html ($src => $dest, $opt);
537    
538     Function:
539     @Name: to_resource_by_uri_in_html
540     @Description:
541     @@@:Make a link to the resource by URI reference (outputted in HTML)
542     @@lang:en
543     @Main:
544     my (undef, $src => $dest, $opt) = @_;
545     local $NestLevel = $NestLevel + 1;
546     if (100 < $NestLevel) {
547     $opt->{parent}->append_new_node (type => '#comment',
548     value => $src->{label});
549 wakaba 1.7 $ERROR->report_error_simple
550     ($opt->{o}->{wiki},
551     $WIKIRESOURCE->get_op ('Error:Condition', $opt->{o})
552     => $WIKIRESOURCE->get_op
553     ('WikiLinking:Error:TooDeep', $opt->{o}),
554     $WIKIRESOURCE->get_op ('Error:Formatter:Template', $opt->{o})
555     => $src->{label},
556     -trace => 1,
557     );
558 wakaba 1.3 return;
559     }
560     local $opt->{o}->{link} = {
561     src => $src,
562     dest => $dest,
563     option => $opt,
564     };
565 wakaba 1.7 $dest->{uri} = ref $dest->{uri} ? $dest->{uri}->canonical
566     : URI->new ($dest->{uri})->canonical;
567 wakaba 1.9 $src->{label} ||= $WIKIRESOURCE->get_text
568     (name => 'Link:toResource:SourceLabel',
569 wakaba 1.4 param => $opt->{o},
570     wiki => $opt->{o}->{wiki});
571 wakaba 1.3 try {
572     SuikaWiki::Plugin->formatter ('link_to_resource')
573     ->replace ($src->{label}, param => $opt->{o}, -parent => $opt->{parent});
574     } catch Message::Util::Formatter::error with {
575     my $err = shift;
576 wakaba 1.5 if ($err->{-object}->{-category_name} eq 'link_to_resource') {
577     my $wiki = $err->{option}->{param}->{wiki};
578     SuikaWiki::Plugin->module_package ('Error')
579     ->reporting_formatting_template_error
580     ($err, $wiki,
581     template => $src->{label});
582 wakaba 1.3 undef;
583     } else {
584     $err->throw;
585     }
586     };
587    
588     Function:
589 wakaba 1.1 @Name: to_wikipage_in_html
590     @Description:
591 wakaba 1.3 @@@:Make a link to the WikiPage (outputed in HTML)
592 wakaba 1.1 @@lang:en
593     @Main:
594     my (undef, $src => $dest, $opt) = @_;
595 wakaba 1.2 local $NestLevel = $NestLevel + 1;
596     if (100 < $NestLevel) {
597     $opt->{parent}->append_new_node (type => '#comment',
598     value => $src->{label});
599 wakaba 1.7 $ERROR->report_error_simple
600     ($opt->{o}->{wiki},
601     $WIKIRESOURCE->get_op ('Error:Condition', $opt->{o})
602     => $WIKIRESOURCE->get_op
603     ('WikiLinking:Error:TooDeep', $opt->{o}),
604     $WIKIRESOURCE->get_op ('Error:Formatter:Template', $opt->{o})
605     => $src->{label},
606     -trace => 1,
607     );
608 wakaba 1.2 return;
609     }
610 wakaba 1.6 $dest->{page_name} = $dest->{page_name_relative}->absolute
611     (base => $dest->{base}, wiki => $opt->{o}->{wiki});
612 wakaba 1.3 ($dest->{uri}, $dest->{absolute_uri})
613     = $opt->{o}->{wiki}->uri_reference
614 wakaba 1.6 (page => $dest->{page_name},
615 wakaba 1.3 mode => $dest->{wiki_mode},
616     anchor_no => $dest->{page_anchor_no},
617     up_to_date => $dest->{_up_to_date},
618     with_lm => $dest->{_with_lm},
619     fragment => $dest->{page_anchor_name},
620 wakaba 1.6 base => $dest->{-use_absolute_uri} ? undef:
621     ($src->{base_uri} || 1));
622    
623 wakaba 1.1 local $opt->{o}->{link} = {
624     src => $src,
625     dest => $dest,
626     option => $opt,
627     };
628 wakaba 1.4 $src->{label} ||= SuikaWiki::Plugin->module_package ('WikiResource')
629     ->get_text (name => 'Link:toWikiPage:SourceLabel',
630     param => $opt->{o},
631     wiki => $opt->{o}->{wiki});
632 wakaba 1.2 try {
633     SuikaWiki::Plugin->formatter ('page_link')
634     ->replace ($src->{label}, param => $opt->{o}, -parent => $opt->{parent});
635     } catch Message::Util::Formatter::error with {
636     my $err = shift;
637 wakaba 1.5 if ($err->{-object}->{-category_name} eq 'page_link') {
638     my $wiki = $err->{option}->{param}->{wiki};
639 wakaba 1.7 SuikaWiki::Plugin->module_package ('Error')
640 wakaba 1.5 ->reporting_formatting_template_error
641     ($err, $wiki,
642     template => $src->{label});
643 wakaba 1.2 undef;
644     } else {
645     $err->throw;
646     }
647     };
648 wakaba 1.1
649 wakaba 1.3 PluginCategory:
650     @Name: page-link
651     @Description:
652     @@@: Source anchor label of link whose destination is a WikiPage
653     @@lang:en
654    
655     PluginCategory:
656     @Name: link-to-resource
657     @Description:
658     @@@: Source anchor label of link whose destination is a resource
659     @@lang:en
660    
661 wakaba 1.2 Resource:
662 wakaba 1.3 @Link:toResource:SourceLabel:
663     @@@:
664     %select-link-resource-scheme (
665     URI => {<%link-to-it(
666     label => {%uri-reference;}p,
667     );>},
668     MAIL => {<%link-to-it(
669     label => {%link-resource-parameters;}p,
670     description
671     => {%res (name=>{Link:MailAddress=});<%link-resource-parameters;>}p,
672     );>},
673     otherwise => {<%link-to-it(
674     label => {%link-resource-scheme;:%link-resource-parameters;}p,
675     );>},
676     );
677 wakaba 1.10 @Link:toWikiPage:NotExist:Mark:
678     @@@: ?
679 wakaba 1.2 @Link:toWikiPage:SourceLabel:
680     @@@:
681     %link-to-it(
682     label=>{%page-title (relative);%if-linked-wikipage-exist(
683     true=>{%if-link-has-dest-anchor-no(true=>{>>%link-dest-anchor-no;});},
684     false=>{%res(name=>{Link:toWikiPage:NotExist:Mark});}
685     );}p,
686     class=>{%if-linked-wikipage-exist(false=>{not-exist});}p,
687     );
688 wakaba 1.3 @Link:MailAddress=:
689     @@@:
690     Internet Mail Address:
691     @@lang:en
692     @Link:URIReference=:
693     @@@:
694     URI Reference:
695     @@lang:en
696 wakaba 1.7 @WikiLinking:Error:TooDeep:
697     @@@:
698     Link nesting too deep.
699     @@lang: en
700     @WikiLinking:LinkToIt:ToResource:Description:
701     %res (name=>{Link:URIReference=});<%uri-reference;>
702     @WikiLinking:LinkToIt:ToWikiPage:Description:
703     %page-name(absolute);; %if-linked-wikipage-exist(
704     true=>{%page-headline;},
705     false=>{(%res(name=>{Link:toWikiPage:NotExist:Description});)},
706     );
707     @WikiLinking:ResourceParameter:
708     @@@: Resource identification parameter
709     @@lang: en
710     @WikiLinking:ResourceScheme:
711     @@@: Resource identification scheme
712     @@lang: en
713     @WikiLinking:ResourceScheme:Unknown:Description:
714     @@@:
715     Unknown resource identification scheme specified.
716     @@lang: en
717    
718    
719    
720    

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24