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