| 1 |
#?SuikaWikiConfig/2.0 |
| 2 |
|
| 3 |
Plugin: |
| 4 |
@Name: HTML |
| 5 |
@Description: |
| 6 |
@@@: Hypertext Markup Language support |
| 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 |
@RequiredModule[list]: |
| 18 |
WikiLinking |
| 19 |
|
| 20 |
PluginConst: |
| 21 |
@NS_XHTML1: |
| 22 |
http://www.w3.org/1999/xhtml |
| 23 |
@NS_XHTML2: |
| 24 |
http://www.w3.org/2002/06/xhtml2 |
| 25 |
|
| 26 |
FormattingRule: |
| 27 |
@Category[list]: view |
| 28 |
@Name: html-document |
| 29 |
@Description: |
| 30 |
@@@: |
| 31 |
A HTML document |
| 32 |
@@lang: en |
| 33 |
@Parameter: |
| 34 |
@@Name: content |
| 35 |
@@Type: text |
| 36 |
@@Default: "" |
| 37 |
@@Description: |
| 38 |
@@@@: Content of the documente (in the BODY element) |
| 39 |
@@@lang:en |
| 40 |
@Parameter: |
| 41 |
@@Name: link-meta |
| 42 |
@@Type: node |
| 43 |
@@Default: (none) |
| 44 |
@@Description: |
| 45 |
@@@@: |
| 46 |
Metainformation that should be included as part of HEAD element |
| 47 |
@@@lang:en |
| 48 |
@Parameter: |
| 49 |
@@Name: pre-element |
| 50 |
@@Type: CDATA |
| 51 |
@@Default: |
| 52 |
%template (name => ht--pre-element-content); |
| 53 |
@@Description: |
| 54 |
@@@@: Pre-root element content (such as PIs) |
| 55 |
@@@lang: en |
| 56 |
@Parameter: |
| 57 |
@@Name: profile |
| 58 |
@@Type: |
| 59 |
html:uris |
| 60 |
@@Default: |
| 61 |
"http://suika.fam.cx/~wakaba/-temp/wiki/wiki?WikiHTMLMetaProfile" |
| 62 |
@@Description: |
| 63 |
@@@@: |
| 64 |
Profile URIs of metainformation (xhtml1:head/@profile or |
| 65 |
xhtml2:html/@profile) |
| 66 |
@@@lang: en |
| 67 |
@Parameter: |
| 68 |
@@Name: stylesheets |
| 69 |
@@Type: CDATA |
| 70 |
@@Default: |
| 71 |
%template (name => ht--stylesheets-html); |
| 72 |
@@Description: |
| 73 |
@@@@: Stylesheet references |
| 74 |
@@@lang: en |
| 75 |
@Parameter: |
| 76 |
@@Name: title |
| 77 |
@@Type: text |
| 78 |
@@Default: (none) |
| 79 |
@@Description: |
| 80 |
@@@@: Title (heading) text of the document |
| 81 |
@@@lang:en |
| 82 |
@Formatting: |
| 83 |
my $HTML = $p->{-parent}->append_new_node (type => '#document'); |
| 84 |
$p->{pre_element} ||= ($p->{-parse_flag}->{pre_element} = 1, |
| 85 |
'%template (name => ht--pre-element-content);'); |
| 86 |
__ATTRNODE:%pre_element->{$HTML}__; |
| 87 |
my $H = $HTML->append_new_node (type => '#element', |
| 88 |
namespace_uri => $NS_XHTML1, |
| 89 |
local_name => 'html'); |
| 90 |
$H->append_text ("\n"); |
| 91 |
my $h = $H->append_new_node (type => '#element', |
| 92 |
namespace_uri => $NS_XHTML1, |
| 93 |
local_name => 'head'); |
| 94 |
__ATTRTEXT:%profile__; |
| 95 |
## Note: HTML 4 requires author being interested in employing |
| 96 |
## link types not referred by it and/or META name |
| 97 |
## to specify profile URI. |
| 98 |
$h->set_attribute (profile => ($p->{profile} or |
| 99 |
q<http://suika.fam.cx/~wakaba/-temp/wiki/wiki?WikiHTMLMetaProfile>)); |
| 100 |
$h->append_text ("\n "); |
| 101 |
## Note: CGI/1.1 draft 3 (section 9.2) recommends CGI script |
| 102 |
## either not to use relative URI reference or to use |
| 103 |
## BASE element, to clarify what the resource referred, |
| 104 |
## since CGI script has no reliable way to know the |
| 105 |
## Request-URI. |
| 106 |
$h->append_new_node (type => '#element', |
| 107 |
namespace_uri => $NS_XHTML1, |
| 108 |
local_name => 'base') |
| 109 |
->set_attribute (href => $o->{wiki}->{input}->request_uri); |
| 110 |
$h->append_text ("\n "); |
| 111 |
__ATTRNODE:%title->{$h->append_new_node (type => '#element', |
| 112 |
namespace_uri => $NS_XHTML1, |
| 113 |
local_name => 'title')}__; |
| 114 |
$h->append_text ("\n "); |
| 115 |
__ATTRNODE:%link_meta->{$h}__; |
| 116 |
$p->{stylesheets} ||= ($p->{-parse_flag}->{stylesheets} = 1, |
| 117 |
'%template (name => ht--stylesheets-html);'); |
| 118 |
__ATTRNODE:%stylesheets->{$h}__; |
| 119 |
__ATTRNODE:%content->{$H}__; |
| 120 |
|
| 121 |
FormattingRule: |
| 122 |
@Category[list]: view |
| 123 |
@Name: html-meta |
| 124 |
@Description: |
| 125 |
@@@: |
| 126 |
name/val pair of metainformation (META element) |
| 127 |
@@lang: en |
| 128 |
@Parameter: |
| 129 |
@@Name: content |
| 130 |
@@Type: text |
| 131 |
@@Default: "" |
| 132 |
@@Description: |
| 133 |
@@@@: Value (meta/@content) |
| 134 |
@@@lang:en |
| 135 |
@Parameter: |
| 136 |
@@Name: name |
| 137 |
@@Type: text |
| 138 |
@@Default: "" |
| 139 |
@@Description: |
| 140 |
@@@@: Name (meta/@name) |
| 141 |
@@@lang:en |
| 142 |
@Formatting: |
| 143 |
my $meta = $p->{-parent}->append_new_node |
| 144 |
(type => '#element', |
| 145 |
namespace_uri => $NS_XHTML1, |
| 146 |
local_name => 'meta'); |
| 147 |
$meta->option (use_EmptyElemTag => 1); |
| 148 |
|
| 149 |
__ATTRTEXT:%name__;__ATTRTEXT:%content__; |
| 150 |
for my $attr (qw/name content/) { |
| 151 |
$meta->set_attribute ($attr => $p->{$attr}) if defined $p->{$attr}; |
| 152 |
} |
| 153 |
|
| 154 |
FormattingRule: |
| 155 |
@Category[list]: |
| 156 |
view |
| 157 |
view-resource |
| 158 |
@Name: link-wiki |
| 159 |
@Description: |
| 160 |
@@@: |
| 161 |
Link from the document to the WikiPage (HTML's LINK element). |
| 162 |
\ |
| 163 |
Note that this rule is a shortcut for WikiLinking rules. |
| 164 |
@@lang:en |
| 165 |
@Parameter: |
| 166 |
@@Name: base-page |
| 167 |
@@Type: WikiName |
| 168 |
@@Default: (current) |
| 169 |
@@Description: |
| 170 |
@@@@:Base WikiName (Relative WikiName is resolved with) |
| 171 |
@@@lang:en |
| 172 |
@Parameter: |
| 173 |
@@Name: class |
| 174 |
@@Type: |
| 175 |
HTML4:class |
| 176 |
@@Default: (none) |
| 177 |
@@Description: |
| 178 |
@@@@:Classes of the link or anchor |
| 179 |
@@@lang:en |
| 180 |
@Parameter: |
| 181 |
@@Name: description |
| 182 |
@@Type: CDATA |
| 183 |
@@Default: (none) |
| 184 |
@@Description: |
| 185 |
@@@@:Description of the link or anchor (HTML's LINK/@title) |
| 186 |
@@@lang:en |
| 187 |
@Parameter: |
| 188 |
@@Name: hreflang |
| 189 |
@@Type: |
| 190 |
HTML4:LanguageCode |
| 191 |
@@Default:(none) |
| 192 |
@@Description: |
| 193 |
@@@@:(Human) language the linked WikiPage written in |
| 194 |
@@@lang:en |
| 195 |
@Parameter: |
| 196 |
@@Name: label |
| 197 |
@@Type: CDATA |
| 198 |
@@Default: (none) |
| 199 |
@@Description: |
| 200 |
@@@@:Source anchor label |
| 201 |
@@@lang:en |
| 202 |
@Parameter: |
| 203 |
@@Name: mode |
| 204 |
@@Type: WikiMode |
| 205 |
@@Default:(default) |
| 206 |
@@Description: |
| 207 |
@@@@:Mode of the Wiki linked to |
| 208 |
@@@lang:en |
| 209 |
@Parameter: |
| 210 |
@@Name: page |
| 211 |
@@Type: WikiName |
| 212 |
@@Default: (current) |
| 213 |
@@Description: |
| 214 |
@@@@:WikiPage linked to |
| 215 |
@@@lang:en |
| 216 |
@Parameter: |
| 217 |
@@Name: page-anchor-name |
| 218 |
@@Type: |
| 219 |
XML:ID |
| 220 |
@@Default: (none) |
| 221 |
@@Description: |
| 222 |
@@@@:Identifier in WikiPage linked to |
| 223 |
@@@lang:en |
| 224 |
@Parameter: |
| 225 |
@@Name: page-anchor-no |
| 226 |
@@Type: |
| 227 |
SGML:NUMBER |
| 228 |
@@Default: (none) |
| 229 |
@@Description: |
| 230 |
@@@@:Numeral anchor index in the WikiPage linked to |
| 231 |
@@@lang:en |
| 232 |
@Parameter: |
| 233 |
@@Name: rel |
| 234 |
@@Type: |
| 235 |
HTML4:LinkTypes |
| 236 |
@@Default:(none) |
| 237 |
@@Description: |
| 238 |
@@@@:Link relationships |
| 239 |
@@@lang:en |
| 240 |
@Parameter: |
| 241 |
@@Name: rev |
| 242 |
@@Type: |
| 243 |
HTML4:LinkTypes |
| 244 |
@@Default:(none) |
| 245 |
@@Description: |
| 246 |
@@@@:Link relationship (reverse) |
| 247 |
@@@lang:en |
| 248 |
# @Parameter: title : obsolete |
| 249 |
@Parameter: |
| 250 |
@@Name: type |
| 251 |
@@Type: |
| 252 |
HTML4:ContentType |
| 253 |
@@Default:(none) |
| 254 |
@@Description: |
| 255 |
@@@@:Media type the linked WikiPage provided with |
| 256 |
@@@lang:en |
| 257 |
@Parameter: |
| 258 |
@@Name: up-to-date |
| 259 |
@@Type: boolean |
| 260 |
@@Default: "0" |
| 261 |
@@Description: |
| 262 |
@@@@:Appends random "up-to-date" parameter to the URI reference |
| 263 |
@@@lang:en |
| 264 |
@Parameter: |
| 265 |
@@Name: with-lm |
| 266 |
@@Type: boolean |
| 267 |
@@Default:"0" |
| 268 |
@@Description: |
| 269 |
@@@@:Appends "last-modified" parameter to the URI reference |
| 270 |
@@@lang:en |
| 271 |
@Formatting: |
| 272 |
__ATTRTEXT:%class__; |
| 273 |
__ATTRNODE:%label__;__ATTRNODE:%description__;__ATTRNODE:%title__; |
| 274 |
__ATTRTEXT:%page__;__ATTRTEXT:%base_page__;__ATTRTEXT:%page_anchor_no__; |
| 275 |
__ATTRTEXT:%with_lm__;__ATTRTEXT:%up_to_date__; |
| 276 |
__ATTRTEXT:%hreflang__;__ATTRTEXT:%type__; |
| 277 |
__ATTRTEXT:%mode__; |
| 278 |
__ATTRTEXT:%rel__;__ATTRTEXT:%rev__; |
| 279 |
SuikaWiki::Plugin->module_package ('WikiLinking') |
| 280 |
->to_wikipage_in_html ( |
| 281 |
{ |
| 282 |
label => qq(%html-link;\n), |
| 283 |
-class => $p->{class}, |
| 284 |
-label => $p->{label}, # obsolete |
| 285 |
-description => $p->{description} || $p->{title}, |
| 286 |
} => { |
| 287 |
base => $o->{wiki}->name ($p->{base_page} || $o->{page}), |
| 288 |
page_name_relative => $o->{wiki}->name ($p->{page} || |
| 289 |
$o->{wiki}->{var}->{page}), |
| 290 |
page_anchor_no => $p->{page_anchor_no}, |
| 291 |
page_anchor_name=> $p->{page_anchor_name}, |
| 292 |
wiki_mode => $p->{mode}, |
| 293 |
_with_lm => $p->{with_lm}, |
| 294 |
_up_to_date => $p->{up_to_date}, |
| 295 |
-lang => $p->{hreflang}, |
| 296 |
-type => $p->{type}, |
| 297 |
}, { |
| 298 |
o => $o, |
| 299 |
parent => $p->{-parent}, |
| 300 |
-rel => $p->{rel}, |
| 301 |
-rev => $p->{rev}, |
| 302 |
}); |
| 303 |
|
| 304 |
FormattingRule: |
| 305 |
@Category[list]: |
| 306 |
page-link |
| 307 |
link-to-resource |
| 308 |
@Name:html-link |
| 309 |
@Description: |
| 310 |
@@@:HTML LINK element |
| 311 |
@@lang:en |
| 312 |
@Parameter: |
| 313 |
@@Name: description |
| 314 |
@@Type: text |
| 315 |
@@Default: (auto) |
| 316 |
@@Description: |
| 317 |
@@@@: Human readable description. |
| 318 |
@@@lang: en |
| 319 |
@Formatting: |
| 320 |
my $LINK = $p->{-parent}->append_new_node |
| 321 |
(type => '#element', |
| 322 |
namespace_uri => $NS_XHTML1, |
| 323 |
local_name => 'link'); |
| 324 |
$LINK->set_attribute (href => $o->{link}->{dest}->{uri}); |
| 325 |
$p->{description} ||= ($p->{-parse_flag}->{description} = 1, |
| 326 |
$o->{link}->{src}->{-ht__alt_description}); |
| 327 |
__ATTRTEXT:%description__; |
| 328 |
if (length $p->{description}) { |
| 329 |
$LINK->set_attribute (title => $p->{description}); |
| 330 |
} elsif (defined $o->{link}->{src}->{-description}) { |
| 331 |
$LINK->set_attribute (title => $o->{link}->{src}->{-description}->inner_text); |
| 332 |
} elsif (defined $o->{link}->{src}->{-label}) { |
| 333 |
$LINK->set_attribute (title => $o->{link}->{src}->{-label}->inner_text); |
| 334 |
} |
| 335 |
my @class = (split (/\s+/, $p->{class}), |
| 336 |
split (/\s+/, $o->{link}->{src}->{-class})); |
| 337 |
if ($o->{wiki}->uri_is_part_of_wiki ($o->{link}->{dest}->{absolute_uri} or |
| 338 |
$o->{link}->{dest}->{uri})) { |
| 339 |
push @class, 'wiki'; ## Link to the page within the Wiki |
| 340 |
} |
| 341 |
$LINK->set_attribute (class => join ' ', @class) if @class; |
| 342 |
|
| 343 |
$LINK->set_attribute (rel => $o->{link}->{option}->{-rel}) |
| 344 |
if $o->{link}->{option}->{-rel}; |
| 345 |
$LINK->set_attribute (rev => $o->{link}->{option}->{-rev}) |
| 346 |
if $o->{link}->{option}->{-rev}; |
| 347 |
|
| 348 |
$LINK->set_attribute (hreflang => $o->{link}->{dest}->{-lang}) |
| 349 |
if $o->{link}->{dest}->{-lang}; |
| 350 |
$LINK->set_attribute (type => $o->{link}->{dest}->{-type}) |
| 351 |
if $o->{link}->{dest}->{-type}; |
| 352 |
|
| 353 |
$LINK->option (use_EmptyElemTag => 1); |
| 354 |
|
| 355 |
FormattingRule: |
| 356 |
@Category[list]: |
| 357 |
form-input |
| 358 |
view |
| 359 |
view-resource |
| 360 |
page-link |
| 361 |
@Name: span |
| 362 |
@Formatting: |
| 363 |
my $span = $p->{-parent}->append_new_node (type => '#element', |
| 364 |
namespace_uri => $NS_XHTML1, |
| 365 |
local_name => 'span'); |
| 366 |
__ATTRTEXT:%class__; |
| 367 |
$span->set_attribute (class => $p->{class}); |
| 368 |
__ATTRNODE:%content->{$span}__; |