use strict; package SuikaWiki::Plugin::Registry; our %Info; $Info{q#SuikaWikiImage09#}->{Name} = q#SuikaWikiImage09#; $Info{q#SuikaWikiImage09#}->{q#Version#} = q#2004.0831.0328#; $Info{q#SuikaWikiImage09#}->{q#InterfaceVersion#} = q#2.9.1#; $Info{q#SuikaWikiImage09#}->{q#mkpluginVersion#} = q#2.1.19#; $Info{q#SuikaWikiImage09#}->{q#module_name#} = q#SuikaWiki::Plugin::plugin::SuikaWikiImage091040731032808EjFd#; $Info{q#SuikaWikiImage09#}->{RequiredPlugin} = [q#SuikaWiki09#]; $Info{q#SuikaWikiImage09#}->{RequiredModule} = []; $Info{q#SuikaWikiImage09#}->{Description} = [[q#SuikaWikiImage/0.9 support#, q#en#, q##]]; $Info{q#SuikaWikiImage09#}->{License} = [[q#%%GPL%%#, q##, q##]]; $Info{q#SuikaWikiImage09#}->{Author} = [[[[q#Wakaba#, q#ja#, q#Latn#]], [[q#w@suika.fam.cx#]], [q##]]]; package SuikaWiki::Plugin::plugin::SuikaWikiImage091040731032808EjFd; #line 1 "(WikiPlugin module source swimg09.wp2, block Plugin/Use)" my $SW09; my $WIKIRESOURCE; my $MODE = { 'image/vnd.microsoft.icon' => { mode => 'image-x-icon', type => 'image/vnd.microsoft.icon', suffix => 'ico', }, 'image/x-icon' => { mode => 'image-x-icon', type => 'image/vnd.microsoft.icon', suffix => 'ico', }, 'image/jpeg' => { mode => 'image-jpeg', type => 'image/jpeg', suffix => 'jpeg', }, 'image/png' => { mode => 'image-png', type => 'image/png', suffix => 'png', }, }; #line 1 "(WikiPlugin module SuikaWikiImage09, chunk 1)" package SuikaWiki::Format::Definition::SuikaWiki::Image::V0_9; our @ISA; push @ISA, q#SuikaWiki::Format::Definition::SuikaWiki::V0_9#; $SuikaWiki::Format::Definition::Class{q#MAGIC:SuikaWikiImage/0.9\#\##} = 'SuikaWiki::Format::Definition::SuikaWiki::Image::V0_9'; $SuikaWiki::Format::Definition::Class{q#IMT:text/x.suikawiki.image;version="0.9"\#\##} = 'SuikaWiki::Format::Definition::SuikaWiki::Image::V0_9'; #line 251 "(WikiPlugin module SuikaWikiImage09, chunk from ../../../bin/mkplugin2.pl)" our $Converter; sub convert ($$;%) { my ($self, $source, %opt) = @_; my $t = SuikaWiki::Format::Definition->serialize_media_type (%opt); my $converter = $Converter->{$t->{_}}; return ($converter->{$opt{return_type} or 'Main'} or CORE::die "Buggy implementation: $t->{_}/@{[$opt{return_type} or 'Main']} not defined") ->($self, $source, \%opt) if $converter; $self->SUPER::convert ($source, %opt); } #line 1 "(WikiPlugin module SuikaWikiImage09, chunk 2)" $Converter->{q#IMT:text/html\#\#f#} = {q#Type#, q#text/html#, q#serialized_type#, q#IMT:text/html\#\#f#, q#Type_param#, {}, q#IsFragment#, q#1#, q#Main#, sub {my ($self, $source, $opt) = @_; #line 1 "(WikiPlugin module source swimg09.wp2, block //Converter/Main)" $opt->{o}->{wiki} ||= $self->{wiki}; my $xml = ($SW09 ||= SuikaWiki::Plugin->module_package ('SuikaWiki09'))->get_xml_tree (text => $source, opt => $opt, wiki => $self->{wiki}); $self->convert ($source, %$opt, Type => 'text/html', IsFragment => 1, IsPlaceholder => 1); ($SW09 ||= SuikaWiki::Plugin->module_package ('SuikaWiki09'))->sw09_to_xhtml1 (source => $xml, parent => $opt->{-parent}, o => $opt->{o}, page => $opt->{page}); if ($opt->{-with_annotation_input}) { SuikaWiki::Plugin->module_package ('WikiFormCore') ->make_content_form_in_html ($opt->{-parent}, ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get (name => 'SuikaWiki/0.9:form:footannotate:input', o => $opt->{o}, wiki => $opt->{o}->{wiki}), option => ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get (name => 'SuikaWiki/0.9:form:footannotate:option', o => $opt->{o}, wiki => $opt->{o}->{wiki}), o => $opt->{o}, wiki => $opt->{o}->{wiki}, output => { page => $opt->{page}, }); } #line 1 "(WikiPlugin module SuikaWikiImage09, chunk 3)" }}; $Converter->{q#IMT:text/html\#\#fp#} = {q#Type#, q#text/html#, q#serialized_type#, q#IMT:text/html\#\#fp#, q#IsPlaceholder#, q#1#, q#Type_param#, {}, q#IsFragment#, q#1#, q#Main#, sub {my ($self, $source, $opt) = @_; #line 1 "(WikiPlugin module source swimg09.wp2, block //Converter/Main)" my $xml = ($SW09 ||= SuikaWiki::Plugin->module_package ('SuikaWiki09'))->get_xml_tree (text => $source, opt => $opt, wiki => $self->{wiki}); my $param = SuikaWiki::Plugin::plugin::SuikaWikiImage091040731032808EjFd->_get_parameter_and_image ($xml); my $fig = $opt->{-parent}->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'div'); $fig->set_attribute (class => 'fig'); my $img = $fig->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'img'); $img->option (use_EmptyElemTag => 1); $img->set_attribute (src => $self->{wiki}->uri_reference (page => $opt->{page}, mode => $MODE->{$param->{'image-type'}} ->{mode}, with_lm => 1, base => 1)); $img->set_attribute (alt => $param->{'image-alt'}); $img->set_attribute (title => $opt->{page}->stringify (wiki => $self->{wiki})); $img->set_attribute (class => 'embed'); $img->set_attribute (longdesc => $self->{wiki}->uri_reference (page => $opt->{page}, base => 1)); $img->set_attribute (type => $MODE->{$param->{'image-type'}}->{type}); #line 1 "(WikiPlugin module SuikaWikiImage09, chunk 4)" }}; $Converter->{q#IMT:image/png\#\##} = {q#ToOctetStream#, sub {my ($self, $source, $opt) = @_; #line 1 "(WikiPlugin module source swimg09.wp2, block //Converter/ToOctetStream)" my $xml = ($SW09 ||= SuikaWiki::Plugin->module_package ('SuikaWiki09'))->get_xml_tree (text => $source, opt => $opt, wiki => $self->{wiki}); my $param = SuikaWiki::Plugin::plugin::SuikaWikiImage091040731032808EjFd->_get_parameter_and_image ($xml); unless ($param->{'image-type'} eq 'image/png') { CORE::die "Image type $param->{'image-type'} not supported"; } require MIME::Base64; return MIME::Base64::decode_base64 ($param->{-body}); #line 1 "(WikiPlugin module SuikaWikiImage09, chunk 5)" }, q#Type#, q#image/png#, q#serialized_type#, q#IMT:image/png\#\##, q#Type_param#, {}}; $Converter->{q#IMT:image/vnd.microsoft.icon\#\##} = {q#ToOctetStream#, sub {my ($self, $source, $opt) = @_; #line 1 "(WikiPlugin module source swimg09.wp2, block //Converter/ToOctetStream)" my $xml = ($SW09 ||= SuikaWiki::Plugin->module_package ('SuikaWiki09'))->get_xml_tree (text => $source, opt => $opt, wiki => $self->{wiki}); my $param = SuikaWiki::Plugin::plugin::SuikaWikiImage091040731032808EjFd->_get_parameter_and_image ($xml); unless ($param->{'image-type'} eq 'image/vnd.microsoft.icon' or $param->{'image-type'} eq 'image/x-icon') { CORE::die "Image type $param->{'image-type'} not supported"; } require MIME::Base64; return MIME::Base64::decode_base64 ($param->{-body}); #line 1 "(WikiPlugin module SuikaWikiImage09, chunk 6)" }, q#Type#, q#image/vnd.microsoft.icon#, q#serialized_type#, q#IMT:image/vnd.microsoft.icon\#\##, q#Type_param#, {}}; package SuikaWiki::Plugin::plugin::SuikaWikiImage091040731032808EjFd; sub _get_parameter_and_image { #line 1 "(WikiPlugin module source swimg09.wp2, block Function[Name='_get_parameter_and_image']/Main)" my (undef, $xml) = @_; my %param; for (@{$xml->child_nodes}) { if ($_->node_type eq '#element' and $_->local_name eq 'document') { for (@{$_->child_nodes}) { if ($_->node_type eq '#element') { if ($_->local_name eq 'head') { for (@{$_->child_nodes}) { if ($_->node_type eq '#element' and $_->local_name eq 'parameter') { my $name = $_->get_attribute_value ('name'); for (@{$_->child_nodes}) { if ($_->node_type eq '#element' and $_->local_name eq 'value') { $param{$name} = $_->inner_text; } } } } } elsif ($_->local_name eq 'image') { $param{-body} = $_->inner_text; last; } } }}} \%param; } #line 1 "(WikiPlugin module SuikaWikiImage09, chunk 7)" package SuikaWiki::Plugin::Resource; our $BaseResource; $BaseResource->{q#en#}->{q##}->{q#WikiFormat:MediaType:Description:IMT:text/x.suikawiki.image;version="0.9"\#\##} = q#SuikaWikiImage/0.9 (text format), i.e. SuikaWiki/0.9 + image embedding, as used in SuikaWiki 2#; $BaseResource->{q#en#}->{q##}->{q#WikiFormat:MediaType:Label:IMT:text/x.suikawiki.image;version="0.9"\#\##} = q#SuikaWikiImage/0.9 (text format)#; $BaseResource->{q#en#}->{q##}->{q#WikiFormat:MediaType:Description:MAGIC:SuikaWikiImage/0.9\#\##} = q#SuikaWikiImage/0.9 (text format), i.e. SuikaWiki/0.9 + image embedding, as used in SuikaWiki 2#; $BaseResource->{q#en#}->{q##}->{q#WikiFormat:MediaType:Label:MAGIC:SuikaWikiImage/0.9\#\##} = q#SuikaWikiImage/0.9 (text format)#; package SuikaWiki::Plugin::Registry; $Info{q#SuikaWikiImage09#}->{provide} = {}; 1;