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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Tue Nov 25 12:38:22 2003 UTC (22 years, 7 months ago) by wakaba
Branch: MAIN
Changes since 1.1: +210 -21 lines
Use new WikiPlugin formatting interface

1 #?SuikaWikiConfig/2.0
2
3 Plugin:
4 @Name: HTML
5 @Description:
6 @@@: Hypertext Markup Language support
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/10/25 06:37:08 $
16 @RequiredModule[list]:
17 WikiLinking
18
19 PluginConst:
20 @NS_XHTML1:
21 http://www.w3.org/1999/xhtml
22 @NS_XHTML2:
23 http://www.w3.org/2002/06/xhtml2
24
25 FormattingRule:
26 @Category[list]: view
27 @Name: html-document
28 @Description:
29 @@@:
30 A HTML document
31 @@lang: en
32 @Parameter:
33 @@Name: content
34 @@Type: text
35 @@Default: ""
36 @@Description:
37 @@@@: Content of the documente (in the BODY element)
38 @@@lang:en
39 @Parameter:
40 @@Name: link-meta
41 @@Type: node
42 @@Default: (none)
43 @@Description:
44 @@@@:
45 Metainformation that should be included as part of HEAD element
46 @@@lang:en
47 @Parameter:
48 @@Name: profile
49 @@Type:
50 html:uris
51 @@Default: "http://suika.fam.cx/~wakaba/-temp/wiki/wiki?WikiHTMLMetaProfile"
52 @@Description:
53 Profile URIs of metainformation (xhtml1:head/@profile or
54 xhtml2:html/@profile)
55 @Parameter:
56 @@Name: title
57 @@Type: text
58 @@Default: (none)
59 @@Description:
60 @@@@: Title (heading) text of the document
61 @@@lang:en
62 @Formatting:
63 my $HTML = $p->{-parent}->append_new_node (type => '#document');
64 my $H = $HTML->append_new_node (type => '#element',
65 namespace_uri => $NS_XHTML1,
66 local_name => 'html');
67 $H->append_text ("\n ");
68 my $h = $H->append_new_node (type => '#element',
69 namespace_uri => $NS_XHTML1,
70 local_name => 'head');
71 __ATTRTEXT:%profile__;
72 $h->set_attribute (profile => ($p->{profile} or
73 q<http://suika.fam.cx/~wakaba/-temp/wiki/wiki?WikiHTMLMetaProfile>));
74 $h->append_text ("\n ");
75 __ATTRNODE:%title->{$h->append_new_node (type => '#element',
76 namespace_uri => $NS_XHTML1,
77 local_name => 'title')}__;
78 $h->append_text ("\n ");
79 __ATTRNODE:%link_meta->{$h}__;
80 __ATTRNODE:%content->{$H}__;
81
82 FormattingRule:
83 @Category[list]: view
84 @Name: html-meta
85 @Description:
86 @@@:
87 name/val pair of metainformation (META element)
88 @@lang: en
89 @Parameter:
90 @@Name: content
91 @@Type: text
92 @@Default: ""
93 @@Description:
94 @@@@: Value (meta/@content)
95 @@@lang:en
96 @Parameter:
97 @@Name: name
98 @@Type: text
99 @@Default: ""
100 @@Description:
101 @@@@: Name (meta/@name)
102 @@@lang:en
103 @Formatting:
104 my $meta = $p->{-parent}->append_new_node
105 (type => '#element',
106 namespace_uri => $NS_XHTML1,
107 local_name => 'meta');
108 $meta->option (use_EmptyElemTag => 1);
109
110 __ATTRTEXT:%name__;__ATTRTEXT:%content__;
111 for my $attr (qw/name content/) {
112 $meta->set_attribute ($attr => $p->{$attr}) if defined $p->{$attr};
113 }
114
115 FormattingRule:
116 @Category[list]:
117 view
118 view-resource
119 @Name: link-wiki
120 @Description:
121 @@@:
122 Link from the document to the WikiPage (HTML's LINK element).
123 \
124 Note that this rule is a shortcut for WikiLinking rules.
125 @@lang:en
126 @Parameter:
127 @@Name: base-page
128 @@Type: WikiName
129 @@Default: (current)
130 @@Description:
131 @@@@:Base WikiName (Relative WikiName is resolved with)
132 @@@lang:en
133 @Parameter:
134 @@Name: class
135 @@Type:
136 HTML4:class
137 @@Default: (none)
138 @@Description:
139 @@@@:Classes of the link or anchor
140 @@@lang:en
141 @Parameter:
142 @@Name: description
143 @@Type: CDATA
144 @@Default: (none)
145 @@Description:
146 @@@@:Description of the link or anchor (HTML's LINK/@title)
147 @@@lang:en
148 @Parameter:
149 @@Name: hreflang
150 @@Type:
151 HTML4:LanguageCode
152 @@Default:(none)
153 @@Description:
154 @@@@:(Human) language the linked WikiPage written in
155 @@@lang:en
156 @Parameter:
157 @@Name: label
158 @@Type: CDATA
159 @@Default: (none)
160 @@Description:
161 @@@@:Source anchor label
162 @@@lang:en
163 @Parameter:
164 @@Name: mode
165 @@Type: WikiMode
166 @@Default:(default)
167 @@Description:
168 @@@@:Mode of the Wiki linked to
169 @@@lang:en
170 @Parameter:
171 @@Name: page
172 @@Type: WikiName
173 @@Default: (current)
174 @@Description:
175 @@@@:WikiPage linked to
176 @@@lang:en
177 @Parameter:
178 @@Name: page-anchor-name
179 @@Type:
180 XML:ID
181 @@Default: (none)
182 @@Description:
183 @@@@:Identifier in WikiPage linked to
184 @@@lang:en
185 @Parameter:
186 @@Name: page-anchor-no
187 @@Type:
188 SGML:NUMBER
189 @@Default: (none)
190 @@Description:
191 @@@@:Numeral anchor index in the WikiPage linked to
192 @@@lang:en
193 @Parameter:
194 @@Name: rel
195 @@Type:
196 HTML4:LinkTypes
197 @@Default:(none)
198 @@Description:
199 @@@@:Link relationships
200 @@@lang:en
201 @Parameter:
202 @@Name: rev
203 @@Type:
204 HTML4:LinkTypes
205 @@Default:(none)
206 @@Description:
207 @@@@:Link relationship (reverse)
208 @@@lang:en
209 # @Parameter: title : obsolete
210 @Parameter:
211 @@Name: type
212 @@Type:
213 HTML4:ContentType
214 @@Default:(none)
215 @@Description:
216 @@@@:Media type the linked WikiPage provided with
217 @@@lang:en
218 @Parameter:
219 @@Name: up-to-date
220 @@Type: boolean
221 @@Default: "0"
222 @@Description:
223 @@@@:Appends random "up-to-date" parameter to the URI reference
224 @@@lang:en
225 @Parameter:
226 @@Name: with-lm
227 @@Type: boolean
228 @@Default:"0"
229 @@Description:
230 @@@@:Appends "last-modified" parameter to the URI reference
231 @@@lang:en
232 @Formatting:
233 __ATTRTEXT:%class__;
234 __ATTRNODE:%label__;__ATTRNODE:%description__;__ATTRNODE:%title__;
235 __ATTRTEXT:%page__;__ATTRTEXT:%base_page__;__ATTRTEXT:%page_anchor_no__;
236 __ATTRTEXT:%with_lm__;__ATTRTEXT:%up_to_date__;
237 __ATTRTEXT:%hreflang__;__ATTRTEXT:%type__;
238 __ATTRTEXT:%mode__;
239 __ATTRTEXT:%rel__;__ATTRTEXT:%rev__;
240 SuikaWiki::Plugin->module_package ('WikiLinking')
241 ->to_wikipage_in_html (
242 {
243 label => qq(%html-link;\n),
244 -class => $p->{class},
245 -label => $p->{label}, # obsolete
246 -description => $p->{description} || $p->{title},
247 } => {
248 base => [split m#//#, ($p->{base_page}||$o->{page})],
249 page_name_relative => [split m#//#, $p->{page}||$o->{page}],
250 page_anchor_no => $p->{page_anchor_no},
251 page_anchor_name=> $p->{page_anchor_name},
252 wiki_mode => $p->{mode},
253 _with_lm => $p->{with_lm},
254 _up_to_date => $p->{up_to_date},
255 -lang => $p->{hreflang},
256 -type => $p->{type},
257 }, {
258 o => $o,
259 parent => $p->{-parent},
260 -rel => $p->{rel},
261 -rev => $p->{rev},
262 });
263
264 FormattingRule:
265 @Category[list]:page-link
266 @Name:html-link
267 @Description:
268 @@@:HTML LINK element
269 @@lang:en
270 @Formatting:
271 my $LINK = $p->{-parent}->append_new_node
272 (type => '#element',
273 namespace_uri => $NS_XHTML1,
274 local_name => 'link');
275 $LINK->set_attribute (href => $o->{link}->{dest}->{uri});
276 if (defined $o->{link}->{src}->{-description}) {
277 $LINK->set_attribute (title => $o->{link}->{src}->{-description}->inner_text);
278 } elsif (defined $o->{link}->{src}->{-label}) {
279 $LINK->set_attribute (title => $o->{link}->{src}->{-label}->inner_text);
280 }
281 my @class = ('wiki', split /\s+/, $o->{link}->{src}->{-class});
282 $LINK->set_attribute (class => join ' ', @class) if @class;
283
284 $LINK->set_attribute (rel => $o->{link}->{option}->{-rel})
285 if $o->{link}->{option}->{-rel};
286 $LINK->set_attribute (rev => $o->{link}->{option}->{-rev})
287 if $o->{link}->{option}->{-rev};
288
289 $LINK->set_attribute (hreflang => $o->{link}->{dest}->{-lang})
290 if $o->{link}->{dest}->{-lang};
291 $LINK->set_attribute (type => $o->{link}->{dest}->{-type})
292 if $o->{link}->{dest}->{-type};
293
294 $LINK->option (use_EmptyElemTag => 1);

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24