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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Fri Dec 26 06:38:42 2003 UTC (22 years, 6 months ago) by wakaba
Branch: MAIN
Changes since 1.4: +30 -15 lines
(set_id): New function

1 #?SuikaWikiConfig/2.0
2
3 Plugin:
4 @Name: WikiStruct
5 @Description:
6 @@@: Structural elements
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 @Date.RCS: $Date: 2003/12/01 07:39:53 $
16
17 ViewFragment:
18 @Name: ws--page
19 @Description:
20 @@@: Basic page body structure
21 @Order: 0
22 @Formatting:
23 %section (level=>1,
24 type => body,
25 title => {%page-name;}p, heading, add-to-toc => 0,
26 content => {
27 %template (name => ws--pre-content);
28 %apply-template (name => content);
29 %template (name => ws--post-content);
30 }p,
31 );
32
33 ViewFragment:
34 @Name: ws--pre-content
35 @Description:
36 @@@: Before content body -- navigation bar
37 @@lang:en
38 @Order: 0
39 @Formatting:
40 %block (
41 id => tools1, class => tools,
42 content => {%template (name => navbar);}p,
43 );
44
45 ViewFragment:
46 @Name: ws--post-content
47 @Description:
48 @@@: After content body -- navigation bar
49 @@lang:en
50 @Order: 900
51 @Formatting:
52 %block (
53 id => tools2, class => tools,
54 content => {%template (name => navbar);}p,
55 );
56
57 ViewFragment:
58 @Name: ws--post-content
59 @Description:
60 @@@: After content body -- footer
61 @@lang:en
62 @Order: 1000
63 @Formatting:
64 %block (
65 id => footer,
66 content => {%template (name => ws--footer);}p,
67 );
68
69 PluginConst:
70 @NS_XHTML1:
71 http://www.w3.org/1999/xhtml
72 @NS_XHTML2:
73 http://www.w3.org/2002/06/xhtml2
74
75 FormattingRule:
76 @Category[list]: view
77 @Name: section
78 @Description:
79 @@@:
80 A section
81
82 Note: "level" parameter used by SuikaWiki 2 will be obsoleted.
83 @@lang: en
84 @Parameter:
85 @@Name: add-to-toc
86 @@Type: boolean
87 @@Default: {1}
88 @@Description:
89 @@@@: Whether adding this section to the Table of Contents list
90 @@@lang:en
91 @Parameter:
92 @@Name: class
93 @@Type: classes
94 @@Default: (none)
95 @@Description:
96 @@@@: Class of section
97 @@@lang:en
98 @Parameter:
99 @@Name: content
100 @@Type: text
101 @@Default: ""
102 @@Description:
103 @@@@: Content of section
104 @@@lang:en
105 @Parameter:
106 @@Name: heading
107 @@Type: boolean
108 @@Default: {0}
109 @@Description: Output title as a heading
110 @Parameter:
111 @@Name: id
112 @@Type:
113 XML:ID
114 @@Default: (none)
115 @@Description:
116 @@@@:
117 Unique identifier
118
119 Note: its uniqueness is not verified by
120 the WikiEngine.
121
122 Note: unless explicily specified, anomymous identifier is generated
123 automatically if necessary
124 @@@lang:en
125 @Parameter:
126 @@Name: title
127 @@Type: text
128 @@Default: (none)
129 @@Description:
130 @@@@: Title (heading) text of the section
131 @@@lang:en
132 @Formatting:
133 __ATTRNODE:%content__;
134 if ($p->{content}->count) {
135 __ATTRTEXT:%type__;
136 my $section = $p->{-parent}->append_new_node
137 (type => '#element',
138 namespace_uri => $NS_XHTML1,
139 local_name => ($p->{type}||'div'));
140 __ATTRTEXT:%class__;
141 $section->set_attribute (class => join ' ', 'wiki-section',
142 split /\s+/, $p->{class});
143 __ATTRTEXT:%id__;
144 __FUNCPACK__->set_id ($section,
145 $p->{id} || 'h'.$o->new_index ('heading'),
146 $o->{wiki});
147 __ATTRTEXT:%heading__;
148 if ($p->{heading}) {
149 __ATTRTEXT:%level__;
150 __ATTRNODE:%title->{
151 $section->append_new_node (type => '#element',
152 namespace_uri => $NS_XHTML1,
153 local_name => 'h'.($p->{level}||'1'))
154 }__;
155 }
156 $section->append_text ("\n");
157 $section->append_node ($p->{content});
158 }
159
160 FormattingRule:
161 @Category[list]:
162 view
163 view-resource
164 form-input
165 @Name: paragraph
166 @Description:
167 @@@:
168 A paragraph
169 @@lang: en
170 @Parameter:
171 @@Name: class
172 @@Type: classes
173 @@Default: (none)
174 @@Description:
175 @@@@: Class of section
176 @@@lang:en
177 @Parameter:
178 @@Name: content
179 @@Type: text
180 @@Default: ""
181 @@Description:
182 @@@@: Content of section
183 @@@lang:en
184 @Parameter:
185 @@Name: id
186 @@Type:
187 XML:ID
188 @@Default: (none)
189 @@Description:
190 @@@@:
191 Unique identifier
192 \
193 Note: its uniqueness is not verified by
194 the WikiEngine.
195 \
196 Note: unless explicily specified, anomymous identifier is generated
197 automatically if necessary
198 @@@lang:en
199 @Formatting:
200 __ATTRNODE:%content__;
201 if ($p->{content}->count) {
202 my $block = $p->{-parent}->append_new_node
203 (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'p');
204 $block->append_node ($p->{content});
205 __ATTRTEXT:%class__;__ATTRTEXT:%id__;
206 $block->set_attribute (class => $p->{class}) if $p->{class};
207 __FUNCPACK__->set_id ($block, $p->{id}, $o->{wiki});
208 }
209
210 FormattingRule:
211 @Category[list]:
212 view
213 view-resource
214 form-input
215 @Name: block
216 @Description:
217 @@@:
218 A semantically-classed block
219 @@lang: en
220 @Parameter:
221 @@Name: class
222 @@Type: classes
223 @@Default: (none)
224 @@Description:
225 @@@@: Class of section
226 @@@lang:en
227 @Parameter:
228 @@Name: content
229 @@Type: text
230 @@Default: ""
231 @@Description:
232 @@@@: Content of section
233 @@@lang:en
234 @Parameter:
235 @@Name: id
236 @@Type:
237 XML:ID
238 @@Default: (none)
239 @@Description:
240 @@@@:
241 Unique identifier
242 \
243 Note: its uniqueness is not verified by
244 the WikiEngine.
245 \
246 Note: unless explicily specified, anomymous identifier is generated
247 automatically if necessary
248 @@@lang:en
249 @Formatting:
250 __ATTRNODE:%content__;
251 if ($p->{content}->count) {
252 my $block = $p->{-parent}->append_new_node
253 (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'div');
254 $block->append_node ($p->{content}, node_or_text => 1);
255 __ATTRTEXT:%class__;__ATTRTEXT:%id__;
256 $block->set_attribute (class => 'block ' . $p->{class});
257 __FUNCPACK__->set_id ($block, $p->{id}, $o->{wiki});
258 }
259
260 FormattingRule:
261 @Category[list]:
262 view
263 view-resource
264 form-input
265 @Name: line
266 @Description:
267 @@@:
268 A semantically line
269 @@lang: en
270 @Parameter:
271 @@Name: class
272 @@Type: classes
273 @@Default: (none)
274 @@Description:
275 @@@@: Class of section
276 @@@lang:en
277 @Parameter:
278 @@Name: content
279 @@Type: text
280 @@Default: ""
281 @@Description:
282 @@@@: Content of the line
283 @@@lang:en
284 @Formatting:
285 __ATTRNODE:%content__;
286 if ($p->{content}->count) {
287 $p->{-parent}->append_node ($p->{content}, node_or_text => 1);
288 $p->{-parent}->append_new_node
289 (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'br')
290 ->option (use_EmptyElemTag => 1);
291 }
292
293 @ ( XHTML 2 ) :
294
295 __ATTRNODE:%content__;
296 if ($p->{content}->count) {
297 my $block = $p->{-parent}->append_new_node
298 (type => '#element', namespace_uri => $NS_XHTML2, local_name => 'l');
299 $block->append_node ($p->{content}, node_or_text => 1);
300 __ATTRTEXT:%class__;
301 $block->set_attribute (class => 'block ' . $p->{class});
302 }
303
304 Function:
305 @Name: set_id
306 @Description:
307 @@@:
308 Set id attribute if necessary.
309 \
310 HTML A element with name attribute is also appended
311 if client user agent is of old version.
312 @@lang:en
313 @Main:
314 my (undef, $node, $id, $wiki) = @_;
315 return unless $id;
316 $node->set_attribute (id => $id);
317 if ($wiki->{var}->{client}->{downgrade}->{html_no_id}) {
318 my $a = $node->append_new_node (type => '#element',
319 namespace_uri => $NS_XHTML1,
320 local_name => 'a');
321 $a->set_attribute (name => $id);
322 unshift @{$node->child_nodes}, pop @{$node->child_nodes};
323 }

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24