/[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.7 - (show annotations) (download)
Sat Feb 14 10:54:41 2004 UTC (21 years, 2 months ago) by wakaba
Branch: MAIN
CVS Tags: suikawiki3-redirect, release-3-0-0, HEAD
Branch point for: paragraph-200404, helowiki, helowiki-2005
Changes since 1.6: +6 -2 lines
tr/-/_/

1 #?SuikaWikiConfig/2.0
2
3 Plugin:
4 @Name: WikiView
5 @Description:
6 @@@: WikiView interface for template context
7 @@lang:en
8 @License: %%Perl%%
9 @Author:
10 @@Name:
11 @@@@: Wakaba
12 @@@lang:ja
13 @@@script:Latn
14 @@Mail[list]: w@suika.fam.cx
15 @Date.RCS:
16 $Date: 2004/02/08 08:52:03 $
17 @RequiredPlugin[list]:
18 Error
19 @Use:
20 use Message::Markup::XML::Node qw(SGML_HEX_CHAR_REF SGML_NCR);
21
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 \
33 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 \
37 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 local $o->{var}->{wv__children} = $p;
49 __ATTRTEXT:%name__;
50 SuikaWiki::Plugin
51 ->formatter ('view')
52 ->replace ($o->{wiki}->{view}->assemble_template ($p->{name}),
53 param => $o, -parent => $p->{-parent});
54
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 __ATTRTEXT:%name__;
72 $p->{name} =~ tr/-/_/;
73 my $template = $o->{var}->{wv__children}->{'_'.$p->{name}};
74 if (length $template) {
75 SuikaWiki::Plugin
76 ->formatter ('view')
77 ->replace ($template,
78 param => $o, -parent => $p->{-parent});
79 }
80
81 FormattingRule:
82 @Category[list]:
83 view
84 view-resource
85 form-input
86 @Name: -bare-text
87 @Formatting:
88 $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 link-to-wikipage
97 we--edit
98 @Name: -undef
99 @Formatting:
100 $p->{-parent}->append_text
101 ("[$f->{-category_name}/$rule_name: not defined]");
102
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 __ATTRTEXT:%ucs__;
122 if ($p->{ucs} =~ /^U\+([0-9A-Fa-f]{4,6})$/) {
123 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 ## Note: NC4 does not support hexdecimal character reference.
137 } elsif ($p->{ucs} =~ /^U-([0-9A-Fa-f]{8})$/) {
138 $p->{-parent}->append_new_node
139 (type => '#reference',
140 namespace_uri => SGML_HEX_CHAR_REF,
141 value => hex $1);
142 } else {
143 $p->{-parent}->append_new_node
144 (type => '#reference',
145 namespace_uri => SGML_HEX_CHAR_REF,
146 value => 0x0000FFFD);
147 }
148
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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24