Name: WikiPlugin FullName: WikiPlugin information URI: IW:SuikaWiki:"Wiki//Plugin" Description: This plugin provides some useful rules to know what/how WikiPlugins works. MODULE section of this plugin also provides some WikiPlugin interface functions not well-defined yet. Even this and other plugin modules can use these functions (and in some case they must use these), the author(s) of such modules should take attentions for being changed those behaviors. { Name: wikiform_input/wiki-plugin-info FullName: Output information of all installed WikiPlugins Format: unless ($SuikaWiki::Plugin::List{_all}) { $r .= qq('''@{[$o->resource('Plugin:NoPluginInstalled')]}'''\n); } else { my $index = 0; for my $pack (sort @{$SuikaWiki::Plugin::List{_all}}) { $index++; my $prop = {}; eval q{$prop = $pack->property ()} or $prop->{add_info} = $@; $r .= <$pack
@{[$o->resource ('Plugin:ModuleName',escape=>1)]}
$pack
@{[$o->resource ('Plugin:Name',escape=>1)]}
@{[$o->escape($prop->{name})]}
@{[$o->resource('Plugin:Version',escape=>1)]}
@{[$o->escape($prop->{version})]}
@{[$o->resource('Plugin:RelatedURI',escape=>1)]}
@{[&main::make_urilink ($prop->{uri})]}
@{[$prop->{description}?qq(
@{[$o->resource('Plugin:Description',escape=>1)]}
@{[$o->escape($prop->{description})]}
):'']} @{[$prop->{add_info}?qq(
@{[$o->resource('Plugin:AddInfo',escape=>1)]}
@{[$o->escape($prop->{add_info})]}
):'']}
@{[$o->resource('Plugin:Provide',escape=>1)]}
    @{[do{my $t = ''; for my $f (@{$prop->{provide}||[]}) { $t .= qq(
  • @{[$o->escape($f)]}
    \n); for (sort grep m#^\Q$f\E/#, keys %{$prop->{partinfo}}) { $t .= qq(
    @{[$o->escape($_)]}
    @{[$o->escape($prop->{partinfo}->{$_}->{FullName})]}
    \n); $t .= qq(\t
    @{[$o->escape($prop->{partinfo}->{$_}->{Description})]}
    \n) if $prop->{partinfo}->{$_}->{Description}; } $t .= qq(
  • \n); }$t}]}
EOH } } } { Name: wikiform_input/wiki-plugin-provide-list FullName: Output "provide" information of the WikiPlugin Format: my $pack = qq(SuikaWiki::Plugin::$p->{name}); eval q{ my $prop = $pack->property (); $r = < @{[do{my $t = ''; for my $f (@{$prop->{provide}||[]}) { $t .= qq(
  • ''@{[$o->escape($f)]}''
      \n); my $dash = $o->resource('Plugin:--',-escape=>1); for (sort grep m#^\Q$f\E/#, keys %{$prop->{partinfo}}) { $t .= qq(
    • ''@{[$o->escape($_)]}'' $dash @{[$o->escape($prop->{partinfo}->{$_})]}
    • \n); } $t .= qq(
  • \n); }$t}]} EOH }; } { Name: wikiform_input/wiki-plugin-property FullName: Returns property of the WikiPlugin Format: my $pack = qq(SuikaWiki::Plugin::$p->{name}); eval q{ $r = SuikaWiki::Markup::XML->new (type => '#text', value => $pack->property ($p->{prop})); 1 } or $r = SuikaWiki::Markup::XML->new (type => '#text', value => $@); } MODULE: ## SuikaWiki::Plugin informal APIs (for formal APIs, see SuikaWiki::Plugin.pm) package SuikaWiki::Plugin; # [obsolete] sub user_agent_names ($) { $main::UA } # [semi-formal] {Image} sub _path_to ($$) { $main::PathTo{$_[1]} } # [obsolete] ->SuikaWiki::SrcFormat sub format_converter ($$$) { my $fmt = SuikaWiki::Plugin->formatter ('format'); $fmt->{($_[1]=~/([A-Za-z0-9]\S+)/?$1:'SuikaWiki/0.9').'_to_'.$_[2]} || $fmt->{($_[1]=~/([A-Za-z0-9](?:(?!\/)\S)+)/?$1:'SuikaWiki').'_to_'.$_[2]}; } # [obsolete] sub formatter_replace_if_not_parsed_yet ($$$$;$) { my ($o, $context, $p, $attr_name, $option) = @_; my $fmt = SuikaWiki::Plugin->formatter ($context); if ((ref $p->{$attr_name} && $p->{$attr_name}->flag ('parsed')) || (!ref $p->{$attr_name} && index ($p->{-option}->{$attr_name}, 'p') > -1)) { $p->{$attr_name}; ## Already parsed } else { $fmt->replace ($p->{$attr_name}, $o, {formatter => $fmt}); } } # [obsolete] sub _database ($) { $main::database } # [obsolete] sub _database_exist ($$) { exists $main::database{$_[1]} } # [obsolete] {WikiLinking, Calender, WikiConst, WikiPage} sub _html_wikilink ($$%) { shift; &main::make_wikilink (@_) } # [semi-formal] Compose URI of WikiPage sub _uri_wiki_page ($$%) { my (undef, $page, %option) = @_; $option{mode} ||= 'read'; length $page ? undef : ($page = $main::PageName{FrontPage}); $option{href} = $main::uri{wiki}.'?'; if ($option{up_to_date} || $option{mode} ne 'read' || $option{add_param} || $option{with_lm}) { $option{href} .= qq(mypage=@{[SuikaWiki::Plugin->encode($page)]};mycmd=@{[SuikaWiki::Plugin->encode($option{mode})]}); $option{href} .= ';'.$option{add_param} if $option{add_param}; ## DISCOURAGED $option{href} .= ';x-d='.time if $option{up_to_date}; $option{href} .= ';x-lm='.(SuikaWiki::Plugin->_database->mtime ($page)||0) if $option{with_lm}; } else { $option{href} .= SuikaWiki::Plugin->encode ($page); } $option{href} .= '#anchor-'.(0+$option{anchor}) if $option{anchor}; $option{href}; } # [obsolete] Use XML or SGML module sub escape ($$) { my $s = $_[1]; $s =~ s|&|&|g; $s =~ s|<|<|g; $s =~ s|>|>|g; $s =~ s|"|"|g; $s =~ s/([\x00-\x08\x0B\x0C\x0E-\x1F])/sprintf '&#%d;', ord $1/ge; ## XML unsafe control chars return $s; } # [obsolete] Use XML or SGML module sub unescape ($$) { my $s = $_[1]; $s =~ s|<|<|g; $s =~ s|>|>|g; $s =~ s|"|"|g; $s =~ s|&|&|g; return $s; } # [obsolete] sub encode ($$) { my $s = $_[1]; $s =~ s/([^0-9A-Za-z_-])/sprintf '%%%02X', ord $1/ge; $s; } # [obsolete] sub decode ($$) { my $s = $_[1]; $s =~ tr/+/ /; $s =~ s/%([A-Fa-f0-9][A-Fa-f0-9])/pack("C", hex($1))/eg; return $s; } # [to be obsolete] sub uri ($$) { $main::uri{$_[1]} } # [formal] sub cache ($$) { our %Cache; my (undef, $name, %option) = @_; unless (ref $Cache{$name}) { require Yuki::YukiWikiCache; my %cache; tie (%cache, 'Yuki::YukiWikiCache', -file => $main::PathTo{CachePrefix}.$name, %option); $Cache{$name} = \%cache; } $Cache{$name}; } # [semi-formal] sub _get_from_database ($$) { require SuikaWiki::SrcFormat; my (undef, $name) = @_; return SuikaWiki::SrcFormat->new ($main::database{$name}); } POD:TO DO: - Rewrite MODULE functions as formal WikiPlugin API. - Use SuikaWiki::Markup::XML. POD:LICENSE: Copyright 2002-2003 Wakaba %%GNUGPL2%%