| 236 |
} elsif ($Converter->{$opt{Name}.'/'.$opt{Version}.$flag}) { |
} elsif ($Converter->{$opt{Name}.'/'.$opt{Version}.$flag}) { |
| 237 |
$converter = $Converter->{'/'.$opt{Name}.'/'.$opt{Version}.$flag}; |
$converter = $Converter->{'/'.$opt{Name}.'/'.$opt{Version}.$flag}; |
| 238 |
} |
} |
| 239 |
return $converter->{Main}->($self, $source, \%opt) if $converter; |
return ($converter->{$opt{return_type} or 'Main'} or |
| 240 |
|
CORE::die "Buggy implementation: $type $opt{Name}/$opt{Version}$flag/@{[$opt{return_type} or 'Main']} not defined") |
| 241 |
|
->($self, $source, \%opt) |
| 242 |
|
if $converter; |
| 243 |
$self->SUPER::convert ($source, %opt); |
$self->SUPER::convert ($source, %opt); |
| 244 |
} |
} |
| 245 |
EOH |
EOH |
| 306 |
$flag .= 'p' and $def{IsPlaceholder} = 1 |
$flag .= 'p' and $def{IsPlaceholder} = 1 |
| 307 |
if $src->get_attribute_value ('IsPlaceholder'); |
if $src->get_attribute_value ('IsPlaceholder'); |
| 308 |
|
|
| 309 |
$def{Main} = $src->get_attribute_value ('Main'); |
for (qw/Main ToString ToOctetStream/) { |
| 310 |
$def{Main} = line ($Info, node_path => '//Converter/Main') |
my $def = $src->get_attribute_value ($_); |
| 311 |
. $def{Main} |
next unless $def; |
| 312 |
. line ($Info, reset => 1); |
$def{$_} = line ($Info, node_path => '//Converter/'.$_) |
| 313 |
if ($def{Main} =~ /\$r\b/) { |
. $def |
| 314 |
$def{Main} = 'my $r;'."\n".$def{Main}."\n".'$r'; |
. line ($Info, reset => 1); |
| 315 |
|
if ($def{$_} =~ /\$r\b/) { |
| 316 |
|
$def{$_} = 'my $r;'."\n".$def{$_}."\n".'$r'; |
| 317 |
|
} |
| 318 |
|
$def{$_} = barecode code $Info, |
| 319 |
|
'sub {my ($self, $source, $opt) = @_;' |
| 320 |
|
. $def{$_} . '}'; |
| 321 |
} |
} |
|
$def{Main} = barecode code $Info, |
|
|
'sub {my ($self, $source, $opt) = @_;' |
|
|
. $def{Main} . '}'; |
|
| 322 |
|
|
| 323 |
my $r = list %def; |
my $r = list %def; |
| 324 |
if ($def{Type}) { |
if ($def{Type}) { |
| 468 |
|
|
| 469 |
\$opt2->{template} = @{[literal $src->get_attribute ('body', make_new_node => 1)->inner_text]}; |
\$opt2->{template} = @{[literal $src->get_attribute ('body', make_new_node => 1)->inner_text]}; |
| 470 |
\$opt2->{o} = bless { |
\$opt2->{o} = bless { |
|
## Compatible options for SuikaWiki 2 WikiPlugin interface |
|
|
param => \\\%main::form, |
|
|
page => \$main::form{mypage}, |
|
|
#toc => [], |
|
|
#magic |
|
|
#content |
|
|
#use_anchor_name |
|
|
media => {@{[hash |
|
|
type => ($src->get_attribute ('media-type',make_new_node=>1)->inner_text |
|
|
|| 'application/octet-stream'), |
|
|
charset => ($src->get_attribute ('use-media-type-charset',make_new_node=>1) |
|
|
->inner_text || 0), |
|
|
## In fact, this value is not referred from any SuikaWiki 2 WikiPlugin rule. |
|
|
#expires => ($src->get_attribute ('expires',make_new_node=>1)->inner_text |
|
|
# || 0) |
|
|
]}}, |
|
| 471 |
## SuikaWiki 3 WikiPlugin interface |
## SuikaWiki 3 WikiPlugin interface |
| 472 |
wiki => \$self->{view}->{wiki}, |
wiki => \$self->{view}->{wiki}, |
| 473 |
plugin => \$self->{view}->{wiki}->{plugin}, |
plugin => \$self->{view}->{wiki}->{plugin}, |
| 491 |
qq{\$opt2->{output}->set_expires (delta => @{[0 + $x]});}; |
qq{\$opt2->{output}->set_expires (delta => @{[0 + $x]});}; |
| 492 |
} |
} |
| 493 |
}]} |
}]} |
| 494 |
|
\$opt2->{output}->{entity}->{body_is_octet_stream} = @{[ |
| 495 |
|
$src->get_attribute ('body')->get_attribute_value ('is-octet-stream', default_value => 0) |
| 496 |
|
or 0 |
| 497 |
|
]}; |
| 498 |
|
|
| 499 |
\$self->{view}->{wiki}->init_db; |
\$self->{view}->{wiki}->init_db; |
| 500 |
\$self->main_pre (\$opt, \$opt2); |
\$self->main_pre (\$opt, \$opt2); |