59 |
$code =~ s/\$$_\b/$Info->{const}->{$_}/ge; |
$code =~ s/\$$_\b/$Info->{const}->{$_}/ge; |
60 |
} |
} |
61 |
$code =~ s/__FUNCPACK__/$Info->{module_name}/g; |
$code =~ s/__FUNCPACK__/$Info->{module_name}/g; |
62 |
|
$code =~ s/__FUNCPACK{([^{}]+)}__/(\$SuikaWiki::Plugin::Registry::Info{@{[literal $1]}}->{module_name} || SuikaWiki::Plugin->module_package (@{[literal $1]}))/g; |
63 |
$code =~ s{<Q:([^:]+):([^>]+)>}{ |
$code =~ s{<Q:([^:]+):([^>]+)>}{ |
64 |
if ($Info->{Namespace}->{$1}) { |
if ($Info->{Namespace}->{$1}) { |
65 |
literal $Info->{Namespace}->{$1}.$2; |
literal $Info->{Namespace}->{$1}.$2; |
117 |
substr ($s, 0, 1) ne '{' ? literal ($s) |
substr ($s, 0, 1) ne '{' ? literal ($s) |
118 |
: code ($Info, substr ($s, 1, length ($s) - 2)); |
: code ($Info, substr ($s, 1, length ($s) - 2)); |
119 |
} |
} |
120 |
|
sub expanded_uri ($$$) { |
121 |
|
my ($Info, $prefix, $lname) = @_; |
122 |
|
warn "$0: $prefix: Namespace prefix not declared" |
123 |
|
unless $Info->{Namespace}->{$prefix}; |
124 |
|
$Info->{Namespace}->{$prefix} . $lname; |
125 |
|
} |
126 |
|
|
127 |
my $parser = Message::Markup::SuikaWikiConfig20::Parser->new; |
my $parser = Message::Markup::SuikaWikiConfig20::Parser->new; |
128 |
my $plugins = $parser->parse_text ($src); |
my $plugins = $parser->parse_text ($src); |
257 |
CORE::die "Buggy implementation: $t->{_}/@{[$opt{return_type} or 'Main']} not defined") |
CORE::die "Buggy implementation: $t->{_}/@{[$opt{return_type} or 'Main']} not defined") |
258 |
->($self, $source, \%opt) |
->($self, $source, \%opt) |
259 |
if $converter; |
if $converter; |
260 |
|
local $Error::Depth = $Error::Depth + 1; |
261 |
$self->SUPER::convert ($source, %opt); |
$self->SUPER::convert ($source, %opt); |
262 |
} |
} |
263 |
EOH |
EOH |
290 |
$r .= code $Info, $_->get_attribute_value ('Main'); |
$r .= code $Info, $_->get_attribute_value ('Main'); |
291 |
$r .= line $Info, reset => 1; |
$r .= line $Info, reset => 1; |
292 |
$r .= qq(}\n); |
$r .= qq(}\n); |
293 |
} elsif ({qw/content_written 1 content_removed 1 content_type_changed_from 1/} |
} elsif ({qw/content_written 1 content_removed 1 content_type_changed_from 1 |
294 |
|
content_prop_modified 1/} |
295 |
->{my $node_name = $_->local_name}) { |
->{my $node_name = $_->local_name}) { |
296 |
$r .= q(sub ).$node_name |
$r .= q(sub ).$node_name |
297 |
. q( {)."\n".q(my ($self, %opt) = @_;) |
. q( {)."\n".q(my ($self, %opt) = @_;) |
302 |
} elsif ($_->local_name eq 'Use') { |
} elsif ($_->local_name eq 'Use') { |
303 |
$r .= line $Info, node_path => qq(Format[module-name()=$module_name]/Use); |
$r .= line $Info, node_path => qq(Format[module-name()=$module_name]/Use); |
304 |
$r .= code $Info, $_->inner_text; |
$r .= code $Info, $_->inner_text; |
305 |
|
} elsif ($_->local_name eq 'Prop') { |
306 |
|
$r .= q<sub prop ($$;%) { my ($self, $name, %opt) = @_;>; |
307 |
|
my $f = 0; |
308 |
|
for my $prop (@{$_->child_nodes}) { |
309 |
|
if ($prop->local_name =~ /^([^:]+):([^:]+)$/) { |
310 |
|
$r .= qq{if (\$name eq @{[literal expanded_uri $Info, $1, $2]}) { return @{[literal $prop->value]} } els}; |
311 |
|
$f = 1; |
312 |
|
} |
313 |
|
} |
314 |
|
$r .= q<e {> if $f; |
315 |
|
$r .= q{$self->SUPER::prop ($name, %opt);}; |
316 |
|
$r .= q<}> if $f; |
317 |
|
$r .= qq<\n}\n>; |
318 |
} |
} |
319 |
} |
} |
320 |
$r; |
$r; |