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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations) (download)
Fri Dec 26 06:34:26 2003 UTC (21 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.3: +5 -3 lines
Don't use hex char ref

1 wakaba 1.1 #?SuikaWikiConfig/2.0
2    
3     Plugin:
4     @Name: WikiView
5     @Description:
6     @@@: WikiView interface for template context
7     @@lang:en
8     @License: %%GPL%%
9     @Author:
10     @@Name:
11     @@@@: Wakaba
12     @@@lang:ja
13     @@@script:Latn
14     @@Mail[list]: w@suika.fam.cx
15 wakaba 1.4 @Date.RCS: $Date: 2003/11/25 12:38:22 $
16 wakaba 1.3 @Use:
17 wakaba 1.4 use Message::Markup::XML::Node qw(SGML_HEX_CHAR_REF SGML_NCR);
18 wakaba 1.1
19     PluginConst:
20     @NS_XHTML1:
21     http://www.w3.org/1999/xhtml
22    
23     FormattingRule:
24     @Category[list]: view
25     @Name: template
26     @Description:
27     @@@:
28     Instantiate template.
29 wakaba 1.3 \
30 wakaba 1.1 In addition to normal parameters, parameter name prefixed by "-"
31     can be specified to replace "%apply-template (name => (name w/o prefix));"
32     in instantiated template.
33 wakaba 1.3 \
34 wakaba 1.1 Warning: Attemplt to apply template which directly or indirectly referring
35     "parent" template will make a infinite loop.
36     @@lang: en
37     @Parameter:
38     @@Name: name
39     @@Type: name
40     @@Default: #REQUIRED
41     @@Description:
42     @@@@: Template name
43     @@@lang:en
44     @Formatting:
45 wakaba 1.3 local $o->{var}->{wv__children} = $p;
46 wakaba 1.1 my $formatter = $o->formatter ('view');
47 wakaba 1.3 $formatter->replace ($o->{wiki}->{view}->assemble_template ($p->{name}),
48     param => $o, -parent => $p->{-parent});
49 wakaba 1.1
50     FormattingRule:
51     @Category[list]: view
52     @Name: apply-template
53     @Description:
54     @@@:
55     Instantiate template defined as a "-" prefixed parameter of "parent"
56     %template; rule.
57     @@lang: en
58     @Parameter:
59     @@Name: name
60     @@Type: name
61     @@Default: #REQUIRED
62     @@Description:
63     @@@@: Name of parameter defining the template, without "-" prefix
64     @@@lang:en
65     @Formatting:
66     my $template = $o->{var}->{wv__children}->{'_'.$p->{name}};
67     if (length $template) {
68 wakaba 1.3 $o->formatter ('view')->replace ($template,
69     param => $o, -parent => $p->{-parent});
70 wakaba 1.1 }
71    
72     FormattingRule:
73 wakaba 1.3 @Category[list]:
74     view
75     view-resource
76     form-input
77 wakaba 1.1 @Name: -bare-text
78     @Formatting:
79 wakaba 1.3 $p->{-parent}->append_text ($p->{-bare_text});
80    
81     FormattingRule:
82     @Category[list]:
83     view
84     view-resource
85     form-input
86     page-link
87 wakaba 1.4 link-to-wikipage
88 wakaba 1.3 we--edit
89     @Name: -undef
90     @Formatting:
91     $p->{-parent}->append_text
92     ("[$f->{-category_name}/$rule_name: not defined]");
93 wakaba 1.1
94     FormattingRule:
95     @Category[list]:
96     view
97     view-resource
98     page-link
99     @Name: char
100     @Description:
101     @@@:
102     A character
103     @@lang: en
104     @Parameter:
105     @@Name: ucs
106     @@Type: "U+hhhh / U+hhhhhh / U-hhhhhhhh"
107     @@Default: #REQUIRED
108     @@Description:
109     @@@@: UCS code position of the character
110     @@@lang:en
111     @Formatting:
112 wakaba 1.3 __ATTRTEXT:%ucs__;
113 wakaba 1.1 if ($p->{ucs} =~ /^U\+([0-9A-Fa-f]{4,6})$/) {
114 wakaba 1.3 $p->{-parent}->append_new_node
115 wakaba 1.1 (type => '#reference',
116 wakaba 1.4 namespace_uri => SGML_NCR,
117 wakaba 1.1 value => hex $1);
118 wakaba 1.4 ## Note: NC4 does not support hexdecimal character reference.
119 wakaba 1.1 } elsif ($p->{ucs} =~ /^U-([0-9A-Fa-f]{8})$/) {
120 wakaba 1.3 $p->{-parent}->append_new_node
121     (type => '#reference',
122     namespace_uri => SGML_HEX_CHAR_REF,
123 wakaba 1.1 value => hex $1);
124     } else {
125 wakaba 1.3 $p->{-parent}->append_new_node
126     (type => '#reference',
127     namespace_uri => SGML_HEX_CHAR_REF,
128     value => 0x0000FFFD);
129 wakaba 1.1 }

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24