/[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.7 - (hide annotations) (download)
Sat Feb 14 10:55:43 2004 UTC (21 years, 8 months ago) by wakaba
Branch: MAIN
Changes since 1.6: +113 -32 lines
Some error message resource'ized

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     $Date: 2004/02/08 08:52:03 $
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.5 my $exists;
460     try {
461     $exists = $o->{wiki}->{db}->exist (content => $page);
462     } catch SuikaWiki::DB::Util::Error with {
463     $exists = 0;
464     };
465     if ($exists) {
466 wakaba 1.1 $rule = __ATTRTEXT:%true__;
467     } else {
468     $rule = __ATTRTEXT:%false__;
469     }
470 wakaba 1.5 SuikaWiki::Plugin->formatter ('page_link')
471 wakaba 1.1 ->replace ($rule, param => $o, -parent => $p->{-parent});
472    
473     FormattingRule:
474     @Category[list]: page-link
475     @Name: if-link-has-dest-anchor-no
476     @Description:
477     @@@: If or if the link has destination numeral anchor
478     @@lang: en
479     @Formatting:
480     my $rule;
481     if ($o->{link}->{dest}->{page_anchor_no}) {
482     $rule = __ATTRTEXT:%true__;
483     } else {
484     $rule = __ATTRTEXT:%false__;
485     }
486     SuikaWiki::Plugin->formatter ('page-link')
487     ->replace ($rule, param => $o, -parent => $p->{-parent});
488    
489     FormattingRule:
490 wakaba 1.3 @Category[list]:
491     page-link
492     link-to-resource
493 wakaba 1.1 @Name:-bare-text
494     @Formatting:
495     $p->{-parent}->append_text ($p->{-bare_text});
496    
497     Function:
498 wakaba 1.3 @Name: to_resource_in_html
499     @Description:
500     @@@Make a link to the resource (outputted in HTML)
501     @@lang:en
502     @Main:
503     my (undef, $src => $dest, $opt) = @_;
504     if ($dest->{resource_scheme} eq 'URI' or
505     $dest->{resource_scheme} eq 'URL') {
506 wakaba 1.7 $dest->{uri} = URI->new ($dest->{resource_parameter});
507 wakaba 1.3 } elsif ($dest->{resource_scheme} eq 'IW') {
508 wakaba 1.5 $dest->{uri} = SuikaWiki::Plugin->module_package ('InterWikiCore')
509 wakaba 1.3 ->interwikireference_to_urireference
510 wakaba 1.5 (packed => $dest->{resource_parameter},
511 wakaba 1.7 name => $dest->{-iw__name},
512     param => $dest->{-iw__parameter},
513 wakaba 1.5 o => $opt->{o},
514 wakaba 1.7 wiki => $opt->{o}->{wiki})
515     || URI->new (q<#err--error>);
516 wakaba 1.3 } elsif ($dest->{resource_scheme} eq 'MAIL') {
517     $dest->{uri} = 'mailto:'.$dest->{resource_parameter};
518     } else {
519 wakaba 1.7 $ERROR->report_error_simple
520     ($opt->{o}->{wiki},
521     $WIKIRESOURCE->get_op ('Error:Condition', $opt->{o})
522     => $WIKIRESOURCE->get_op
523     ('WikiLinking:ResourceScheme:Unknown:Description',
524     $opt->{o}),
525     $WIKIRESOURCE->get_op ('WikiLinking:ResourceScheme', $opt->{o})
526     => $dest->{resource_scheme},
527     $WIKIRESOURCE->get_op ('WikiLinking:ResourceParameter',
528     $opt->{o})
529     => $dest->{resource_parameter},
530     );
531     $dest->{uri} = URI->new (q<#err--error>);
532 wakaba 1.3 }
533     __FUNCPACK__->to_resource_by_uri_in_html ($src => $dest, $opt);
534    
535     Function:
536     @Name: to_resource_by_uri_in_html
537     @Description:
538     @@@:Make a link to the resource by URI reference (outputted in HTML)
539     @@lang:en
540     @Main:
541     my (undef, $src => $dest, $opt) = @_;
542     local $NestLevel = $NestLevel + 1;
543     if (100 < $NestLevel) {
544     $opt->{parent}->append_new_node (type => '#comment',
545     value => $src->{label});
546 wakaba 1.7 $ERROR->report_error_simple
547     ($opt->{o}->{wiki},
548     $WIKIRESOURCE->get_op ('Error:Condition', $opt->{o})
549     => $WIKIRESOURCE->get_op
550     ('WikiLinking:Error:TooDeep', $opt->{o}),
551     $WIKIRESOURCE->get_op ('Error:Formatter:Template', $opt->{o})
552     => $src->{label},
553     -trace => 1,
554     );
555 wakaba 1.3 return;
556     }
557     local $opt->{o}->{link} = {
558     src => $src,
559     dest => $dest,
560     option => $opt,
561     };
562 wakaba 1.7 $dest->{uri} = ref $dest->{uri} ? $dest->{uri}->canonical
563     : URI->new ($dest->{uri})->canonical;
564 wakaba 1.4 $src->{label} ||= SuikaWiki::Plugin->module_package ('WikiResource')
565     ->get_text (name => 'Link:toResource:SourceLabel',
566     param => $opt->{o},
567     wiki => $opt->{o}->{wiki});
568 wakaba 1.3 try {
569     SuikaWiki::Plugin->formatter ('link_to_resource')
570     ->replace ($src->{label}, param => $opt->{o}, -parent => $opt->{parent});
571     } catch Message::Util::Formatter::error with {
572     my $err = shift;
573 wakaba 1.5 if ($err->{-object}->{-category_name} eq 'link_to_resource') {
574     my $wiki = $err->{option}->{param}->{wiki};
575     SuikaWiki::Plugin->module_package ('Error')
576     ->reporting_formatting_template_error
577     ($err, $wiki,
578     template => $src->{label});
579 wakaba 1.3 undef;
580     } else {
581     $err->throw;
582     }
583     };
584    
585     Function:
586 wakaba 1.1 @Name: to_wikipage_in_html
587     @Description:
588 wakaba 1.3 @@@:Make a link to the WikiPage (outputed in HTML)
589 wakaba 1.1 @@lang:en
590     @Main:
591     my (undef, $src => $dest, $opt) = @_;
592 wakaba 1.2 local $NestLevel = $NestLevel + 1;
593     if (100 < $NestLevel) {
594     $opt->{parent}->append_new_node (type => '#comment',
595     value => $src->{label});
596 wakaba 1.7 $ERROR->report_error_simple
597     ($opt->{o}->{wiki},
598     $WIKIRESOURCE->get_op ('Error:Condition', $opt->{o})
599     => $WIKIRESOURCE->get_op
600     ('WikiLinking:Error:TooDeep', $opt->{o}),
601     $WIKIRESOURCE->get_op ('Error:Formatter:Template', $opt->{o})
602     => $src->{label},
603     -trace => 1,
604     );
605 wakaba 1.2 return;
606     }
607 wakaba 1.6 $dest->{page_name} = $dest->{page_name_relative}->absolute
608     (base => $dest->{base}, wiki => $opt->{o}->{wiki});
609 wakaba 1.3 ($dest->{uri}, $dest->{absolute_uri})
610     = $opt->{o}->{wiki}->uri_reference
611 wakaba 1.6 (page => $dest->{page_name},
612 wakaba 1.3 mode => $dest->{wiki_mode},
613     anchor_no => $dest->{page_anchor_no},
614     up_to_date => $dest->{_up_to_date},
615     with_lm => $dest->{_with_lm},
616     fragment => $dest->{page_anchor_name},
617 wakaba 1.6 base => $dest->{-use_absolute_uri} ? undef:
618     ($src->{base_uri} || 1));
619    
620 wakaba 1.1 local $opt->{o}->{link} = {
621     src => $src,
622     dest => $dest,
623     option => $opt,
624     };
625 wakaba 1.4 $src->{label} ||= SuikaWiki::Plugin->module_package ('WikiResource')
626     ->get_text (name => 'Link:toWikiPage:SourceLabel',
627     param => $opt->{o},
628     wiki => $opt->{o}->{wiki});
629 wakaba 1.2 try {
630     SuikaWiki::Plugin->formatter ('page_link')
631     ->replace ($src->{label}, param => $opt->{o}, -parent => $opt->{parent});
632     } catch Message::Util::Formatter::error with {
633     my $err = shift;
634 wakaba 1.5 if ($err->{-object}->{-category_name} eq 'page_link') {
635     my $wiki = $err->{option}->{param}->{wiki};
636 wakaba 1.7 SuikaWiki::Plugin->module_package ('Error')
637 wakaba 1.5 ->reporting_formatting_template_error
638     ($err, $wiki,
639     template => $src->{label});
640 wakaba 1.2 undef;
641     } else {
642     $err->throw;
643     }
644     };
645 wakaba 1.1
646 wakaba 1.3 PluginCategory:
647     @Name: page-link
648     @Description:
649     @@@: Source anchor label of link whose destination is a WikiPage
650     @@lang:en
651    
652     PluginCategory:
653     @Name: link-to-resource
654     @Description:
655     @@@: Source anchor label of link whose destination is a resource
656     @@lang:en
657    
658 wakaba 1.2 Resource:
659 wakaba 1.3 @Link:toResource:SourceLabel:
660     @@@:
661     %select-link-resource-scheme (
662     URI => {<%link-to-it(
663     label => {%uri-reference;}p,
664     );>},
665     MAIL => {<%link-to-it(
666     label => {%link-resource-parameters;}p,
667     description
668     => {%res (name=>{Link:MailAddress=});<%link-resource-parameters;>}p,
669     );>},
670     otherwise => {<%link-to-it(
671     label => {%link-resource-scheme;:%link-resource-parameters;}p,
672     );>},
673     );
674 wakaba 1.2 @Link:toWikiPage:SourceLabel:
675     @@@:
676     %link-to-it(
677     label=>{%page-title (relative);%if-linked-wikipage-exist(
678     true=>{%if-link-has-dest-anchor-no(true=>{>>%link-dest-anchor-no;});},
679     false=>{%res(name=>{Link:toWikiPage:NotExist:Mark});}
680     );}p,
681     class=>{%if-linked-wikipage-exist(false=>{not-exist});}p,
682     );
683 wakaba 1.3 @Link:MailAddress=:
684     @@@:
685     Internet Mail Address:
686     @@lang:en
687     @Link:URIReference=:
688     @@@:
689     URI Reference:
690     @@lang:en
691 wakaba 1.7 @WikiLinking:Error:TooDeep:
692     @@@:
693     Link nesting too deep.
694     @@lang: en
695     @WikiLinking:LinkToIt:ToResource:Description:
696     %res (name=>{Link:URIReference=});<%uri-reference;>
697     @WikiLinking:LinkToIt:ToWikiPage:Description:
698     %page-name(absolute);; %if-linked-wikipage-exist(
699     true=>{%page-headline;},
700     false=>{(%res(name=>{Link:toWikiPage:NotExist:Description});)},
701     );
702     @WikiLinking:ResourceParameter:
703     @@@: Resource identification parameter
704     @@lang: en
705     @WikiLinking:ResourceScheme:
706     @@@: Resource identification scheme
707     @@lang: en
708     @WikiLinking:ResourceScheme:Unknown:Description:
709     @@@:
710     Unknown resource identification scheme specified.
711     @@lang: en
712    
713    
714    
715    

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24