/[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.3 - (hide annotations) (download)
Fri Dec 26 06:35:00 2003 UTC (22 years, 6 months ago) by wakaba
Branch: MAIN
Changes since 1.2: +17 -3 lines
Don't use obsoleted $o->{page}

1 wakaba 1.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 wakaba 1.3 @Date.RCS: $Date: 2003/11/25 12:38:22 $
16 wakaba 1.2 @RequiredModule[list]:
17     WikiLinking
18 wakaba 1.1
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 wakaba 1.2 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 wakaba 1.3 $H->append_text ("\n");
68 wakaba 1.2 my $h = $H->append_new_node (type => '#element',
69     namespace_uri => $NS_XHTML1,
70     local_name => 'head');
71     __ATTRTEXT:%profile__;
72 wakaba 1.3 ## Note: HTML 4 requires author being interested in employing
73     ## link types not referred by it and/or META name
74     ## to specify profile URI.
75 wakaba 1.2 $h->set_attribute (profile => ($p->{profile} or
76     q<http://suika.fam.cx/~wakaba/-temp/wiki/wiki?WikiHTMLMetaProfile>));
77     $h->append_text ("\n ");
78 wakaba 1.3 ## Note: CGI/1.1 draft 3 (section 9.2) recommends CGI script
79     ## either not to use relative URI reference or to use
80     ## BASE element, to clarify what the resource referred,
81     ## since CGI script has no reliable way to know the
82     ## Request-URI.
83     $h->append_new_node (type => '#element',
84     namespace_uri => $NS_XHTML1,
85     local_name => 'base')
86     ->set_attribute (href => $o->{wiki}->{input}->request_uri);
87     $h->append_text ("\n ");
88 wakaba 1.2 __ATTRNODE:%title->{$h->append_new_node (type => '#element',
89     namespace_uri => $NS_XHTML1,
90     local_name => 'title')}__;
91     $h->append_text ("\n ");
92     __ATTRNODE:%link_meta->{$h}__;
93     __ATTRNODE:%content->{$H}__;
94 wakaba 1.1
95     FormattingRule:
96     @Category[list]: view
97     @Name: html-meta
98     @Description:
99     @@@:
100     name/val pair of metainformation (META element)
101     @@lang: en
102     @Parameter:
103     @@Name: content
104     @@Type: text
105     @@Default: ""
106     @@Description:
107     @@@@: Value (meta/@content)
108     @@@lang:en
109     @Parameter:
110     @@Name: name
111     @@Type: text
112     @@Default: ""
113     @@Description:
114     @@@@: Name (meta/@name)
115     @@@lang:en
116     @Formatting:
117 wakaba 1.2 my $meta = $p->{-parent}->append_new_node
118     (type => '#element',
119     namespace_uri => $NS_XHTML1,
120     local_name => 'meta');
121     $meta->option (use_EmptyElemTag => 1);
122    
123     __ATTRTEXT:%name__;__ATTRTEXT:%content__;
124 wakaba 1.1 for my $attr (qw/name content/) {
125 wakaba 1.2 $meta->set_attribute ($attr => $p->{$attr}) if defined $p->{$attr};
126     }
127    
128     FormattingRule:
129     @Category[list]:
130     view
131     view-resource
132     @Name: link-wiki
133     @Description:
134     @@@:
135     Link from the document to the WikiPage (HTML's LINK element).
136     \
137     Note that this rule is a shortcut for WikiLinking rules.
138     @@lang:en
139     @Parameter:
140     @@Name: base-page
141     @@Type: WikiName
142     @@Default: (current)
143     @@Description:
144     @@@@:Base WikiName (Relative WikiName is resolved with)
145     @@@lang:en
146     @Parameter:
147     @@Name: class
148     @@Type:
149     HTML4:class
150     @@Default: (none)
151     @@Description:
152     @@@@:Classes of the link or anchor
153     @@@lang:en
154     @Parameter:
155     @@Name: description
156     @@Type: CDATA
157     @@Default: (none)
158     @@Description:
159     @@@@:Description of the link or anchor (HTML's LINK/@title)
160     @@@lang:en
161     @Parameter:
162     @@Name: hreflang
163     @@Type:
164     HTML4:LanguageCode
165     @@Default:(none)
166     @@Description:
167     @@@@:(Human) language the linked WikiPage written in
168     @@@lang:en
169     @Parameter:
170     @@Name: label
171     @@Type: CDATA
172     @@Default: (none)
173     @@Description:
174     @@@@:Source anchor label
175     @@@lang:en
176     @Parameter:
177     @@Name: mode
178     @@Type: WikiMode
179     @@Default:(default)
180     @@Description:
181     @@@@:Mode of the Wiki linked to
182     @@@lang:en
183     @Parameter:
184     @@Name: page
185     @@Type: WikiName
186     @@Default: (current)
187     @@Description:
188     @@@@:WikiPage linked to
189     @@@lang:en
190     @Parameter:
191     @@Name: page-anchor-name
192     @@Type:
193     XML:ID
194     @@Default: (none)
195     @@Description:
196     @@@@:Identifier in WikiPage linked to
197     @@@lang:en
198     @Parameter:
199     @@Name: page-anchor-no
200     @@Type:
201     SGML:NUMBER
202     @@Default: (none)
203     @@Description:
204     @@@@:Numeral anchor index in the WikiPage linked to
205     @@@lang:en
206     @Parameter:
207     @@Name: rel
208     @@Type:
209     HTML4:LinkTypes
210     @@Default:(none)
211     @@Description:
212     @@@@:Link relationships
213     @@@lang:en
214     @Parameter:
215     @@Name: rev
216     @@Type:
217     HTML4:LinkTypes
218     @@Default:(none)
219     @@Description:
220     @@@@:Link relationship (reverse)
221     @@@lang:en
222     # @Parameter: title : obsolete
223     @Parameter:
224     @@Name: type
225     @@Type:
226     HTML4:ContentType
227     @@Default:(none)
228     @@Description:
229     @@@@:Media type the linked WikiPage provided with
230     @@@lang:en
231     @Parameter:
232     @@Name: up-to-date
233     @@Type: boolean
234     @@Default: "0"
235     @@Description:
236     @@@@:Appends random "up-to-date" parameter to the URI reference
237     @@@lang:en
238     @Parameter:
239     @@Name: with-lm
240     @@Type: boolean
241     @@Default:"0"
242     @@Description:
243     @@@@:Appends "last-modified" parameter to the URI reference
244     @@@lang:en
245     @Formatting:
246     __ATTRTEXT:%class__;
247     __ATTRNODE:%label__;__ATTRNODE:%description__;__ATTRNODE:%title__;
248     __ATTRTEXT:%page__;__ATTRTEXT:%base_page__;__ATTRTEXT:%page_anchor_no__;
249     __ATTRTEXT:%with_lm__;__ATTRTEXT:%up_to_date__;
250     __ATTRTEXT:%hreflang__;__ATTRTEXT:%type__;
251     __ATTRTEXT:%mode__;
252     __ATTRTEXT:%rel__;__ATTRTEXT:%rev__;
253     SuikaWiki::Plugin->module_package ('WikiLinking')
254     ->to_wikipage_in_html (
255     {
256     label => qq(%html-link;\n),
257     -class => $p->{class},
258     -label => $p->{label}, # obsolete
259     -description => $p->{description} || $p->{title},
260     } => {
261     base => [split m#//#, ($p->{base_page}||$o->{page})],
262 wakaba 1.3 page_name_relative => $p->{page} ? [split m#//#, $p->{page}]:
263     $o->{wiki}->{var}->{page},
264 wakaba 1.2 page_anchor_no => $p->{page_anchor_no},
265     page_anchor_name=> $p->{page_anchor_name},
266     wiki_mode => $p->{mode},
267     _with_lm => $p->{with_lm},
268     _up_to_date => $p->{up_to_date},
269     -lang => $p->{hreflang},
270     -type => $p->{type},
271     }, {
272     o => $o,
273     parent => $p->{-parent},
274     -rel => $p->{rel},
275     -rev => $p->{rev},
276     });
277    
278     FormattingRule:
279     @Category[list]:page-link
280     @Name:html-link
281     @Description:
282     @@@:HTML LINK element
283     @@lang:en
284     @Formatting:
285     my $LINK = $p->{-parent}->append_new_node
286     (type => '#element',
287     namespace_uri => $NS_XHTML1,
288     local_name => 'link');
289     $LINK->set_attribute (href => $o->{link}->{dest}->{uri});
290     if (defined $o->{link}->{src}->{-description}) {
291     $LINK->set_attribute (title => $o->{link}->{src}->{-description}->inner_text);
292     } elsif (defined $o->{link}->{src}->{-label}) {
293     $LINK->set_attribute (title => $o->{link}->{src}->{-label}->inner_text);
294 wakaba 1.1 }
295 wakaba 1.2 my @class = ('wiki', split /\s+/, $o->{link}->{src}->{-class});
296     $LINK->set_attribute (class => join ' ', @class) if @class;
297    
298     $LINK->set_attribute (rel => $o->{link}->{option}->{-rel})
299     if $o->{link}->{option}->{-rel};
300     $LINK->set_attribute (rev => $o->{link}->{option}->{-rev})
301     if $o->{link}->{option}->{-rev};
302    
303     $LINK->set_attribute (hreflang => $o->{link}->{dest}->{-lang})
304     if $o->{link}->{dest}->{-lang};
305     $LINK->set_attribute (type => $o->{link}->{dest}->{-type})
306     if $o->{link}->{dest}->{-type};
307    
308     $LINK->option (use_EmptyElemTag => 1);

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24