5 |
@Description: |
@Description: |
6 |
@@@: Stylesheet support |
@@@: Stylesheet support |
7 |
@@lang:en |
@@lang:en |
8 |
@License: %%GPL%% |
@License: %%Perl%% |
9 |
@Author: |
@Author: |
10 |
@@Name: |
@@Name: |
11 |
@@@@: Wakaba |
@@@@: Wakaba |
12 |
@@@lang:ja |
@@@lang:ja |
13 |
@@@script:Latn |
@@@script:Latn |
14 |
@@Mail[list]: w@suika.fam.cx |
@@Mail[list]: w@suika.fam.cx |
15 |
@Date.RCS: $Date$ |
@Date.RCS: |
16 |
@RequiredModule[list]: |
$Date$ |
17 |
@RequiredPlugin[list]: |
@RequiredPlugin[list]: |
18 |
Error |
Error |
19 |
HTML |
HTML |
20 |
|
@RequiredModule[list]: |
21 |
|
URI |
22 |
@Use: |
@Use: |
23 |
|
use URI; |
24 |
use Message::Util::Error; |
use Message::Util::Error; |
25 |
my $WIKIRESOURCE; |
my $WIKIRESOURCE; |
26 |
|
@Namespace: |
27 |
|
@@ss: |
28 |
|
http://suika.fam.cx/~wakaba/archive/2004/05/sw-stylesheet# |
29 |
|
@@media-type: |
30 |
|
http://suika.fam.cx/~wakaba/-temp/2004/04/24/mt# |
31 |
|
|
32 |
PluginConst: |
PluginConst: |
33 |
@NS_XHTML1: |
@NS_XHTML1: |
73 |
$node->append_text ($$source); |
$node->append_text ($$source); |
74 |
return $node; |
return $node; |
75 |
|
|
76 |
|
@content_written: |
77 |
|
@@Main: |
78 |
|
if ($opt{wiki}->{config}->{<Q:ss:use-static>}) { |
79 |
|
$opt{wiki}->{db}->set (static__css => $opt{page} => ${$opt{new_content}}); |
80 |
|
} |
81 |
|
|
82 |
|
@content_removed: |
83 |
|
@@Main: |
84 |
|
if ($opt{wiki}->{config}->{<Q:ss:use-static>}) { |
85 |
|
$opt{wiki}->{db}->delete (static__css => $opt{page}); |
86 |
|
} |
87 |
|
|
88 |
|
@content_type_changed_from: |
89 |
|
@@Main: |
90 |
|
if ($opt{wiki}->{config}->{<Q:ss:use-static>}) { |
91 |
|
$opt{wiki}->{db}->delete (static__css => $opt{page}); |
92 |
|
} |
93 |
|
|
94 |
ViewDefinition: |
ViewDefinition: |
95 |
@Mode: css |
@Mode: css |
96 |
@Condition: |
@Condition: |
148 |
: $dg->{ua_winie30} ? 'WinIE3.0' |
: $dg->{ua_winie30} ? 'WinIE3.0' |
149 |
: 1; |
: 1; |
150 |
} |
} |
151 |
|
|
152 |
|
my $mkuri = $o->{wiki}->{config}->{<Q:ss:wikiname-to-uri>} || |
153 |
|
\ \&__FUNCPACK__::generate_uri; |
154 |
|
|
155 |
for my $set (@{$list->child_nodes}) { |
for my $set (@{$list->child_nodes}) { |
156 |
if ($set->local_name eq 'StyleSet') { |
if ($set->local_name eq 'StyleSet') { |
181 |
my $media_descriptor = $sheet->get_attribute_value ('Media'); |
my $media_descriptor = $sheet->get_attribute_value ('Media'); |
182 |
$link->set_attribute (media => $media_descriptor || 'all'); |
$link->set_attribute (media => $media_descriptor || 'all'); |
183 |
} |
} |
184 |
my $mode = 'css'; ## ISSUE: Make this media-type independent! |
my $uri = $mkuri->(undef, o => $o, wiki => $o->{wiki}, |
185 |
$link->set_attribute |
wikiname => $o->{wiki}->name |
186 |
(href => $o->{wiki}->uri_reference |
($sheet->get_attribute_value |
|
(page => $o->{wiki}->name |
|
|
($sheet->get_attribute_value |
|
187 |
('WikiPage', default => '')), |
('WikiPage', default => '')), |
188 |
mode => $mode, |
mode => 'css'); ## ISSUE: Make this media-type independent! |
189 |
with_lm => 1, base => 1)); |
$link->set_attribute (href => $uri); |
190 |
$parent->append_text ("\n"); |
$parent->append_text ("\n"); |
191 |
} |
} |
192 |
} |
} |
234 |
return unless $list; |
return unless $list; |
235 |
my $parent = $p->{-parent}; |
my $parent = $p->{-parent}; |
236 |
|
|
237 |
|
my $mkuri = $o->{wiki}->{config}->{<Q:ss:wikiname-to-uri>} || |
238 |
|
\ \&__FUNCPACK__::generate_uri; |
239 |
|
|
240 |
for my $set (@{$list->child_nodes}) { |
for my $set (@{$list->child_nodes}) { |
241 |
if ($set->local_name eq 'StyleSet') { |
if ($set->local_name eq 'StyleSet') { |
242 |
my $type = {map {$_ => 1} |
my $type = {map {$_ => 1} |
265 |
my $media_descriptor = $sheet->get_attribute_value ('Media'); |
my $media_descriptor = $sheet->get_attribute_value ('Media'); |
266 |
$link->set_attribute (media => $media_descriptor || 'all'); |
$link->set_attribute (media => $media_descriptor || 'all'); |
267 |
} |
} |
268 |
my $mode = 'css'; ## ISSUE: Make this media-type independent! |
my $uri = $mkuri->(undef, o => $o, wiki => $o->{wiki}, |
269 |
$link->set_attribute |
wikiname => $o->{wiki}->name |
270 |
(href => $o->{wiki}->uri_reference |
($sheet->get_attribute_value |
|
(page => $o->{wiki}->name |
|
|
($sheet->get_attribute_value |
|
271 |
('WikiPage', default => '')), |
('WikiPage', default => '')), |
272 |
mode => $mode, |
mode => 'css'); ## ISSUE: Make this media-type independent! |
273 |
with_lm => 1)); |
$link->set_attribute (href => $uri); |
274 |
$parent->append_text ("\n"); |
$parent->append_text ("\n"); |
275 |
} |
} |
276 |
} |
} |
277 |
} |
} |
278 |
} |
} |
279 |
|
|
280 |
|
Function: |
281 |
|
@Name: generate_uri |
282 |
|
@Description: |
283 |
|
@@@: Default generator for stylesheet URI |
284 |
|
@@lang: en |
285 |
|
@Main: |
286 |
|
my (undef, %opt) = @_; |
287 |
|
return $opt{wiki}->uri_reference |
288 |
|
(page => $opt{wikiname}, |
289 |
|
mode => $opt{mode}, |
290 |
|
with_lm => 1, base => 1); |
291 |
|
|
292 |
|
ViewDefinition: |
293 |
|
@Mode: ss--no-static |
294 |
|
@Condition: |
295 |
|
@@http-method[list]: |
296 |
|
GET |
297 |
|
HEAD |
298 |
|
POST |
299 |
|
@Description: |
300 |
|
@@@: Generate static version |
301 |
|
@@lang: en |
302 |
|
@method: |
303 |
|
@@Name: main |
304 |
|
@@@: |
305 |
|
require SuikaWiki::Output::HTTP; |
306 |
|
my $wiki = $self->{view}->{wiki}; |
307 |
|
$wiki->init_db; |
308 |
|
|
309 |
|
GENSTATIC: { |
310 |
|
last GENSTATIC unless ref $wiki->{config}->{<Q:ss:uri-to-wikiname>} and |
311 |
|
$wiki->{config}->{<Q:ss:use-static>} and |
312 |
|
$wiki->{db} and $wiki->{input}; |
313 |
|
my $uri = $wiki->{input}->meta_variable ('REDIRECT_URL'); |
314 |
|
last GENSTATIC unless $uri; |
315 |
|
my $wn = $wiki->{config}->{<Q:ss:uri-to-wikiname>} |
316 |
|
->(undef, wiki => $wiki, |
317 |
|
uri => URI->new ($uri)); |
318 |
|
|
319 |
|
my $prop = $wiki->{db}->get (content_prop => $wn); |
320 |
|
my $mt = $prop->get_attribute_value (<Q:media-type:media-type>, |
321 |
|
default => '--'); |
322 |
|
last GENSTATIC unless $mt eq 'IMT:text/css##'; |
323 |
|
|
324 |
|
$wiki->{db}->set (static__css => $wn => |
325 |
|
$wiki->{db}->get (content => $wn)); |
326 |
|
|
327 |
|
$uri = $wiki->{config}->{<Q:ss:wikiname-to-uri>} |
328 |
|
->(undef, wiki => $wiki, |
329 |
|
wikiname => $wn); |
330 |
|
$uri = $uri->abs ($wiki->uri_reference); |
331 |
|
$uri->query (time); |
332 |
|
|
333 |
|
my $output = new SuikaWiki::Output::HTTP (wiki => $wiki); |
334 |
|
$output->set_redirect (uri => $uri, status_code => 303, |
335 |
|
status_phrase => 'Created'); |
336 |
|
$output->output (output => 'http-cgi'); |
337 |
|
|
338 |
|
return; |
339 |
|
} |
340 |
|
my $output = new SuikaWiki::Output::HTTP (wiki => $wiki); |
341 |
|
$output->{status_code} = 404; |
342 |
|
$output->{entity}->{media_type} = 'text/plain'; |
343 |
|
$output->{entity}->{body} = '404'; |
344 |
|
$output->output (output => 'http-cgi'); |
345 |
|
|
346 |
FormattingRule: |
FormattingRule: |
347 |
@Category[list]: |
@Category[list]: |
348 |
view |
view |
446 |
} |
} |
447 |
|
|
448 |
__ATTRTEXT:%expires__; |
__ATTRTEXT:%expires__; |
449 |
my $cookie_path = '/'; ## ISSUE: Need some mechanism |
my $cookie_path = $o->{wiki}->uri_reference->path; |
450 |
for ($div->append_new_node (type => '#element', |
for ($div->append_new_node (type => '#element', |
451 |
namespace_uri => $NS_XHTML1, |
namespace_uri => $NS_XHTML1, |
452 |
local_name => 'script')) { |
local_name => 'script')) { |
558 |
@Main: |
@Main: |
559 |
my (undef, %opt) = @_; |
my (undef, %opt) = @_; |
560 |
my $content; |
my $content; |
561 |
|
my $content_prop; |
562 |
if ($opt{wiki}->{db}) { |
if ($opt{wiki}->{db}) { |
563 |
try { |
try { |
564 |
$content = $opt{wiki}->{db}->get (content => $opt{page}); |
$content = $opt{wiki}->{db}->get (content => $opt{page}); |
565 |
|
$content_prop = $opt{wiki}->{db}->get (content_prop => $opt{page}); |
566 |
} catch SuikaWiki::DB::Util::Error with { |
} catch SuikaWiki::DB::Util::Error with { |
567 |
|
my $err = shift; |
568 |
|
$err->throw if $err->{-type} eq 'ERROR_REPORTED'; |
569 |
$content = undef; |
$content = undef; |
570 |
}; |
}; |
571 |
} |
} |
572 |
my $format = SuikaWiki::Plugin->module_package ('WikiFormat') |
my $format = SuikaWiki::Plugin->module_package ('WikiFormat') |
573 |
->handler (\$content, |
->handler (\$content, |
574 |
|
content_prop => $content_prop, |
575 |
o => $opt{o}, |
o => $opt{o}, |
576 |
wiki => $opt{o}->{wiki}); |
wiki => $opt{o}->{wiki}); |
577 |
my $cfg; |
my $cfg; |
706 |
} |
} |
707 |
|
|
708 |
__ATTRTEXT:%expires__; |
__ATTRTEXT:%expires__; |
709 |
my $cookie_path = '/'; ## ISSUE: Need some mechanism |
my $cookie_path = $o->{wiki}->uri_reference->path; |
710 |
for ($div->append_new_node (type => '#element', |
for ($div->append_new_node (type => '#element', |
711 |
namespace_uri => $NS_XHTML1, |
namespace_uri => $NS_XHTML1, |
712 |
local_name => 'script')) { |
local_name => 'script')) { |
805 |
@@@: |
@@@: |
806 |
Save style selection |
Save style selection |
807 |
@@lang: en |
@@lang: en |
808 |
|
@WikiFormat:MediaType:Description:IMT:text/css##: |
809 |
|
@@@: CSS (Cascading Style Sheets) |
810 |
|
@@lang: en |
811 |
|
@WikiFormat:MediaType:Label:IMT:text/css##: |
812 |
|
@@@: CSS |
813 |
|
@@lang: en |
814 |
|
|
815 |
|
|