/[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.4 - (hide annotations) (download)
Mon Dec 1 07:39:53 2003 UTC (22 years, 7 months ago) by wakaba
Branch: MAIN
Changes since 1.3: +2 -2 lines
Defaults to h1 unless level

1 wakaba 1.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 wakaba 1.4 @Date.RCS: $Date: 2003/11/25 12:38:22 $
16 wakaba 1.1
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 wakaba 1.2
45 wakaba 1.1 ViewFragment:
46     @Name: ws--post-content
47     @Description:
48     @@@: After content body -- navigation bar
49     @@lang:en
50 wakaba 1.2 @Order: 900
51 wakaba 1.1 @Formatting:
52     %block (
53 wakaba 1.2 id => tools2, class => tools,
54 wakaba 1.1 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 wakaba 1.3 @NS_XHTML2:
73     http://www.w3.org/2002/06/xhtml2
74 wakaba 1.1
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 wakaba 1.3 __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:%id__;
141     ## TODO: indexing
142     my $id = $p->{id} || 'h'.$o->new_index ('heading');
143     $section->set_attribute (id => $id);
144     ## TODO:
145     $section->append_new_node (type => '#element',
146     namespace_uri => $NS_XHTML1,
147     local_name => 'a')
148     ->set_attribute (name => $id)
149     if $o->{use_anchor_name};
150     __ATTRTEXT:%class__;
151     $section->set_attribute (class => ($p->{class} ? $p->{class} . ' ' : '')
152     . 'wiki-section');
153     __ATTRTEXT:%heading__;
154     if ($p->{heading}) {
155     __ATTRTEXT:%level__;
156     __ATTRNODE:%title->{
157     $section->append_new_node (type => '#element',
158     namespace_uri => $NS_XHTML1,
159 wakaba 1.4 local_name => 'h'.($p->{level}||'1'))
160 wakaba 1.3 }__;
161     }
162     $section->append_text ("\n");
163     $section->append_node ($p->{content});
164     }
165 wakaba 1.1
166     FormattingRule:
167 wakaba 1.3 @Category[list]:
168     view
169     view-resource
170     form-input
171 wakaba 1.1 @Name: paragraph
172     @Description:
173     @@@:
174     A paragraph
175     @@lang: en
176     @Parameter:
177     @@Name: class
178     @@Type: classes
179     @@Default: (none)
180     @@Description:
181     @@@@: Class of section
182     @@@lang:en
183     @Parameter:
184     @@Name: content
185     @@Type: text
186     @@Default: ""
187     @@Description:
188     @@@@: Content of section
189     @@@lang:en
190     @Parameter:
191     @@Name: id
192     @@Type:
193     XML:ID
194     @@Default: (none)
195     @@Description:
196     @@@@:
197     Unique identifier
198 wakaba 1.3 \
199 wakaba 1.1 Note: its uniqueness is not verified by
200     the WikiEngine.
201 wakaba 1.3 \
202 wakaba 1.1 Note: unless explicily specified, anomymous identifier is generated
203     automatically if necessary
204     @@@lang:en
205     @Formatting:
206 wakaba 1.3 __ATTRNODE:%content__;
207     if ($p->{content}->count) {
208     my $block = $p->{-parent}->append_new_node
209 wakaba 1.1 (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'p');
210 wakaba 1.3 $block->append_node ($p->{content});
211     __ATTRTEXT:%class__;__ATTRTEXT:%id__;
212     $block->set_attribute (class => $p->{class}) if $p->{class};
213     $block->set_attribute (id => $p->{id}) if $p->{id}; ## TODO: ensure ID syntax and uniquness
214 wakaba 1.1 }
215    
216     FormattingRule:
217 wakaba 1.3 @Category[list]:
218     view
219     view-resource
220     form-input
221 wakaba 1.1 @Name: block
222     @Description:
223     @@@:
224     A semantically-classed block
225     @@lang: en
226     @Parameter:
227     @@Name: class
228     @@Type: classes
229     @@Default: (none)
230     @@Description:
231     @@@@: Class of section
232     @@@lang:en
233     @Parameter:
234     @@Name: content
235     @@Type: text
236     @@Default: ""
237     @@Description:
238     @@@@: Content of section
239     @@@lang:en
240     @Parameter:
241     @@Name: id
242     @@Type:
243     XML:ID
244     @@Default: (none)
245     @@Description:
246     @@@@:
247     Unique identifier
248 wakaba 1.3 \
249 wakaba 1.1 Note: its uniqueness is not verified by
250     the WikiEngine.
251 wakaba 1.3 \
252 wakaba 1.1 Note: unless explicily specified, anomymous identifier is generated
253     automatically if necessary
254     @@@lang:en
255     @Formatting:
256 wakaba 1.3 __ATTRNODE:%content__;
257     if ($p->{content}->count) {
258     my $block = $p->{-parent}->append_new_node
259 wakaba 1.1 (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'div');
260 wakaba 1.3 $block->append_node ($p->{content}, node_or_text => 1);
261     __ATTRTEXT:%class__;__ATTRTEXT:%id__;
262     $block->set_attribute (class => 'block ' . $p->{class});
263     $block->set_attribute (id => $p->{id}) if $p->{id}; ## TODO: ensure ID syntax and uniquness
264 wakaba 1.1 }
265    
266     FormattingRule:
267 wakaba 1.3 @Category[list]:
268     view
269     view-resource
270     form-input
271     @Name: line
272 wakaba 1.1 @Description:
273     @@@:
274 wakaba 1.3 A semantically line
275 wakaba 1.1 @@lang: en
276     @Parameter:
277 wakaba 1.3 @@Name: class
278     @@Type: classes
279     @@Default: (none)
280     @@Description:
281     @@@@: Class of section
282     @@@lang:en
283     @Parameter:
284     @@Name: content
285     @@Type: text
286     @@Default: ""
287 wakaba 1.1 @@Description:
288 wakaba 1.3 @@@@: Content of the line
289 wakaba 1.1 @@@lang:en
290     @Formatting:
291 wakaba 1.3 __ATTRNODE:%content__;
292     if ($p->{content}->count) {
293     $p->{-parent}->append_node ($p->{content}, node_or_text => 1);
294     $p->{-parent}->append_new_node
295     (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'br')
296     ->option (use_EmptyElemTag => 1);
297     }
298    
299     @ ( XHTML 2 ) :
300    
301     __ATTRNODE:%content__;
302     if ($p->{content}->count) {
303     my $block = $p->{-parent}->append_new_node
304     (type => '#element', namespace_uri => $NS_XHTML2, local_name => 'l');
305     $block->append_node ($p->{content}, node_or_text => 1);
306     __ATTRTEXT:%class__;
307     $block->set_attribute (class => 'block ' . $p->{class});
308     }

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24