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 |
|
$Info->{Namespace}->{$prefix} . $lname; |
124 |
|
} |
125 |
|
|
126 |
my $parser = Message::Markup::SuikaWikiConfig20::Parser->new; |
my $parser = Message::Markup::SuikaWikiConfig20::Parser->new; |
127 |
my $plugins = $parser->parse_text ($src); |
my $plugins = $parser->parse_text ($src); |
288 |
$r .= code $Info, $_->get_attribute_value ('Main'); |
$r .= code $Info, $_->get_attribute_value ('Main'); |
289 |
$r .= line $Info, reset => 1; |
$r .= line $Info, reset => 1; |
290 |
$r .= qq(}\n); |
$r .= qq(}\n); |
291 |
} 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 |
292 |
|
content_prop_modified 1/} |
293 |
->{my $node_name = $_->local_name}) { |
->{my $node_name = $_->local_name}) { |
294 |
$r .= q(sub ).$node_name |
$r .= q(sub ).$node_name |
295 |
. q( {)."\n".q(my ($self, %opt) = @_;) |
. q( {)."\n".q(my ($self, %opt) = @_;) |
300 |
} elsif ($_->local_name eq 'Use') { |
} elsif ($_->local_name eq 'Use') { |
301 |
$r .= line $Info, node_path => qq(Format[module-name()=$module_name]/Use); |
$r .= line $Info, node_path => qq(Format[module-name()=$module_name]/Use); |
302 |
$r .= code $Info, $_->inner_text; |
$r .= code $Info, $_->inner_text; |
303 |
|
} elsif ($_->local_name eq 'Prop') { |
304 |
|
$r .= q<sub prop ($$;%) { my ($self, $name, %opt) = @_;>; |
305 |
|
my $f = 0; |
306 |
|
for my $prop (@{$_->child_nodes}) { |
307 |
|
if ($prop->local_name =~ /^([^:]+):([^:]+)$/) { |
308 |
|
$r .= qq{if (\$name eq @{[literal expanded_uri $Info, $1, $2]}) { return @{[literal $prop->value]} } els}; |
309 |
|
$f = 1; |
310 |
|
} |
311 |
|
} |
312 |
|
$r .= q<e {> if $f; |
313 |
|
$r .= q{$self->SUPER::prop ($name, %opt);}; |
314 |
|
$r .= q<}> if $f; |
315 |
|
$r .= qq<\n}\n>; |
316 |
} |
} |
317 |
} |
} |
318 |
$r; |
$r; |