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 |
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.6 |
@RequiredPlugin[list]: |
18 |
|
|
Error |
19 |
wakaba |
1.3 |
@Use: |
20 |
wakaba |
1.4 |
use Message::Markup::XML::Node qw(SGML_HEX_CHAR_REF SGML_NCR); |
21 |
wakaba |
1.1 |
|
22 |
|
|
PluginConst: |
23 |
|
|
@NS_XHTML1: |
24 |
|
|
http://www.w3.org/1999/xhtml |
25 |
|
|
|
26 |
|
|
FormattingRule: |
27 |
|
|
@Category[list]: view |
28 |
|
|
@Name: template |
29 |
|
|
@Description: |
30 |
|
|
@@@: |
31 |
|
|
Instantiate template. |
32 |
wakaba |
1.3 |
\ |
33 |
wakaba |
1.1 |
In addition to normal parameters, parameter name prefixed by "-" |
34 |
|
|
can be specified to replace "%apply-template (name => (name w/o prefix));" |
35 |
|
|
in instantiated template. |
36 |
wakaba |
1.3 |
\ |
37 |
wakaba |
1.1 |
Warning: Attemplt to apply template which directly or indirectly referring |
38 |
|
|
"parent" template will make a infinite loop. |
39 |
|
|
@@lang: en |
40 |
|
|
@Parameter: |
41 |
|
|
@@Name: name |
42 |
|
|
@@Type: name |
43 |
|
|
@@Default: #REQUIRED |
44 |
|
|
@@Description: |
45 |
|
|
@@@@: Template name |
46 |
|
|
@@@lang:en |
47 |
|
|
@Formatting: |
48 |
wakaba |
1.3 |
local $o->{var}->{wv__children} = $p; |
49 |
wakaba |
1.7 |
__ATTRTEXT:%name__; |
50 |
wakaba |
1.6 |
SuikaWiki::Plugin |
51 |
|
|
->formatter ('view') |
52 |
|
|
->replace ($o->{wiki}->{view}->assemble_template ($p->{name}), |
53 |
|
|
param => $o, -parent => $p->{-parent}); |
54 |
wakaba |
1.1 |
|
55 |
|
|
FormattingRule: |
56 |
|
|
@Category[list]: view |
57 |
|
|
@Name: apply-template |
58 |
|
|
@Description: |
59 |
|
|
@@@: |
60 |
|
|
Instantiate template defined as a "-" prefixed parameter of "parent" |
61 |
|
|
%template; rule. |
62 |
|
|
@@lang: en |
63 |
|
|
@Parameter: |
64 |
|
|
@@Name: name |
65 |
|
|
@@Type: name |
66 |
|
|
@@Default: #REQUIRED |
67 |
|
|
@@Description: |
68 |
|
|
@@@@: Name of parameter defining the template, without "-" prefix |
69 |
|
|
@@@lang:en |
70 |
|
|
@Formatting: |
71 |
wakaba |
1.7 |
__ATTRTEXT:%name__; |
72 |
|
|
$p->{name} =~ tr/-/_/; |
73 |
wakaba |
1.1 |
my $template = $o->{var}->{wv__children}->{'_'.$p->{name}}; |
74 |
|
|
if (length $template) { |
75 |
wakaba |
1.6 |
SuikaWiki::Plugin |
76 |
|
|
->formatter ('view') |
77 |
|
|
->replace ($template, |
78 |
|
|
param => $o, -parent => $p->{-parent}); |
79 |
wakaba |
1.1 |
} |
80 |
|
|
|
81 |
|
|
FormattingRule: |
82 |
wakaba |
1.3 |
@Category[list]: |
83 |
|
|
view |
84 |
|
|
view-resource |
85 |
|
|
form-input |
86 |
wakaba |
1.1 |
@Name: -bare-text |
87 |
|
|
@Formatting: |
88 |
wakaba |
1.3 |
$p->{-parent}->append_text ($p->{-bare_text}); |
89 |
|
|
|
90 |
|
|
FormattingRule: |
91 |
|
|
@Category[list]: |
92 |
|
|
view |
93 |
|
|
view-resource |
94 |
|
|
form-input |
95 |
|
|
page-link |
96 |
wakaba |
1.4 |
link-to-wikipage |
97 |
wakaba |
1.3 |
we--edit |
98 |
|
|
@Name: -undef |
99 |
|
|
@Formatting: |
100 |
|
|
$p->{-parent}->append_text |
101 |
|
|
("[$f->{-category_name}/$rule_name: not defined]"); |
102 |
wakaba |
1.1 |
|
103 |
|
|
FormattingRule: |
104 |
|
|
@Category[list]: |
105 |
|
|
view |
106 |
|
|
view-resource |
107 |
|
|
page-link |
108 |
|
|
@Name: char |
109 |
|
|
@Description: |
110 |
|
|
@@@: |
111 |
|
|
A character |
112 |
|
|
@@lang: en |
113 |
|
|
@Parameter: |
114 |
|
|
@@Name: ucs |
115 |
|
|
@@Type: "U+hhhh / U+hhhhhh / U-hhhhhhhh" |
116 |
|
|
@@Default: #REQUIRED |
117 |
|
|
@@Description: |
118 |
|
|
@@@@: UCS code position of the character |
119 |
|
|
@@@lang:en |
120 |
|
|
@Formatting: |
121 |
wakaba |
1.3 |
__ATTRTEXT:%ucs__; |
122 |
wakaba |
1.1 |
if ($p->{ucs} =~ /^U\+([0-9A-Fa-f]{4,6})$/) { |
123 |
wakaba |
1.5 |
my $char = hex $1; |
124 |
|
|
if ($o->{wiki}->{var}->{client}->{downgrade}->{html_no_latin1} |
125 |
|
|
and $char <= 0x00FF and 0x00A0 <= $char) { |
126 |
|
|
$p->{-parent}->append_text ({ |
127 |
|
|
0xA0 => ' ', |
128 |
|
|
0xA9 => '(C)', |
129 |
|
|
}->{$char} || sprintf '&#x%02X;', $char); |
130 |
|
|
} else { |
131 |
|
|
$p->{-parent}->append_new_node |
132 |
|
|
(type => '#reference', |
133 |
|
|
namespace_uri => SGML_NCR, |
134 |
|
|
value => hex $1); |
135 |
|
|
} |
136 |
wakaba |
1.4 |
## Note: NC4 does not support hexdecimal character reference. |
137 |
wakaba |
1.1 |
} elsif ($p->{ucs} =~ /^U-([0-9A-Fa-f]{8})$/) { |
138 |
wakaba |
1.3 |
$p->{-parent}->append_new_node |
139 |
|
|
(type => '#reference', |
140 |
|
|
namespace_uri => SGML_HEX_CHAR_REF, |
141 |
wakaba |
1.1 |
value => hex $1); |
142 |
|
|
} else { |
143 |
wakaba |
1.3 |
$p->{-parent}->append_new_node |
144 |
|
|
(type => '#reference', |
145 |
|
|
namespace_uri => SGML_HEX_CHAR_REF, |
146 |
|
|
value => 0x0000FFFD); |
147 |
wakaba |
1.1 |
} |
148 |
wakaba |
1.6 |
|
149 |
|
|
ViewDefinition: |
150 |
|
|
@Mode: -wv--no-view-definition |
151 |
|
|
@Condition: |
152 |
|
|
@@http-method[list]: |
153 |
|
|
GET |
154 |
|
|
HEAD |
155 |
|
|
POST |
156 |
|
|
@Description: |
157 |
|
|
@@@: WikiView definition matches to the request not found |
158 |
|
|
@@lang: en |
159 |
|
|
@template: |
160 |
|
|
@@http-status-code: 406 |
161 |
|
|
@@http-status-phrase: WikiView Definition Not Found |
162 |
|
|
@@media-type: text/html |
163 |
|
|
@@use-media-type-charset: 1 |
164 |
|
|
@@expires: %%error%% |
165 |
|
|
@@body: |
166 |
|
|
%html-document ( |
167 |
|
|
title => {%res (name => {WikiView:NoViewDef:WebPageTitle});}p, |
168 |
|
|
link-meta => {%template (name => links);}p, |
169 |
|
|
content => { |
170 |
|
|
%block (id => tools1, class => tools, |
171 |
|
|
content => {%template (name => navbar);}p); |
172 |
|
|
%section ( |
173 |
|
|
title => {%res (name => {WikiView:NoViewDef:Title});}p, heading, |
174 |
|
|
content => {%paragraph ( |
175 |
|
|
content => {%res (name => {WikiView:NoViewDef:Description});}p, |
176 |
|
|
);%error-list ( |
177 |
|
|
no-error => {%res (name => {Error:NoErrorReported});}p, |
178 |
|
|
);}p, |
179 |
|
|
); |
180 |
|
|
%block (id => footer, content => {%template (name => ws--footer);}p); |
181 |
|
|
}p, |
182 |
|
|
); |
183 |
|
|
|
184 |
|
|
Resource: |
185 |
|
|
@WikiView:NoViewDef:Description: |
186 |
|
|
@@@: |
187 |
|
|
WikiView definition that matches to your request does not found. |
188 |
|
|
@@lang: en |
189 |
|
|
@WikiView:NoViewDef:Title: |
190 |
|
|
@@@: WikiView Definition Not Found |
191 |
|
|
@@lang: en |
192 |
|
|
@WikiView:NoViewDef:WebPageTitle: |
193 |
|
|
@@@: 406 WikiView Definition Not Found (%page-name;) |
194 |
|
|
@@lang: en |
195 |
|
|
|