| 22 |
|
|
| 23 |
=over 4 |
=over 4 |
| 24 |
|
|
|
=begin temp |
|
|
|
|
|
=item $o->new_index ($index_name) |
|
|
|
|
|
Increments the index number and returns the new index number. |
|
|
|
|
|
=end temp |
|
|
|
|
|
=cut |
|
|
|
|
|
## Should be obsolete? Need consideration |
|
|
{my %Index; |
|
|
sub new_index ($$) { ++$Index{$_[1]} } |
|
|
} |
|
|
|
|
| 25 |
=item $formatter = SuikaWiki::Plugin->formatter ($category_name) |
=item $formatter = SuikaWiki::Plugin->formatter ($category_name) |
| 26 |
|
|
| 27 |
Returns an instance of formatter whose category (context) is |
Returns an instance of formatter whose category (context) is |
| 39 |
return $Formatter{$t}; |
return $Formatter{$t}; |
| 40 |
}} |
}} |
| 41 |
|
|
| 42 |
|
{my %Formatter; |
| 43 |
|
sub text_formatter ($$) { |
| 44 |
|
my $t = $_[1]; $t =~ tr/-/_/; |
| 45 |
|
unless ($Formatter{$t}) { |
| 46 |
|
$Formatter{$t} = new SuikaWiki::Plugin::text_formatter |
| 47 |
|
-category_name => $t; |
| 48 |
|
} |
| 49 |
|
return $Formatter{$t}; |
| 50 |
|
}} |
| 51 |
|
|
| 52 |
|
{my %Formatter; |
| 53 |
|
sub boolean_formatter ($$) { |
| 54 |
|
my $t = $_[1]; $t =~ tr/-/_/; |
| 55 |
|
unless ($Formatter{$t}) { |
| 56 |
|
$Formatter{$t} = new SuikaWiki::Plugin::boolean_formatter |
| 57 |
|
-category_name => $t; |
| 58 |
|
} |
| 59 |
|
return $Formatter{$t}; |
| 60 |
|
}} |
| 61 |
|
|
| 62 |
=item $package = SuikaWiki::Plugin->module_package ($plugin_name) |
=item $package = SuikaWiki::Plugin->module_package ($plugin_name) |
| 63 |
|
|
| 64 |
Returns package name of the plugin module named $plugin_name. |
Returns package name of the plugin module named $plugin_name. |
| 92 |
file => $dir, |
file => $dir, |
| 93 |
message => $!, |
message => $!, |
| 94 |
-object => $self, method => 'load_directory'; |
-object => $self, method => 'load_directory'; |
| 95 |
for (grep {substr ($_, -3) eq '.pm'} readdir (PDIR)) { |
for (grep {substr ($_, -3) eq '.pm'} readdir PDIR) { |
| 96 |
eval { require $dir.'/'.$_ }; |
eval { require $dir.'/'.$_ }; |
| 97 |
if ($@) { |
if ($@) { |
| 98 |
throw SuikaWiki::Plugin::error |
throw SuikaWiki::Plugin::error |
| 137 |
bless {@_}, $class; |
bless {@_}, $class; |
| 138 |
} |
} |
| 139 |
|
|
| 140 |
|
sub exit ($) { |
| 141 |
|
my $self = shift; |
| 142 |
|
delete $self->{wiki}; |
| 143 |
|
$self->{exited} = 1; |
| 144 |
|
} |
| 145 |
|
|
| 146 |
|
sub DESTROY ($) { |
| 147 |
|
my $self = shift; |
| 148 |
|
$self->exit unless $self->{exited}; |
| 149 |
|
} |
| 150 |
|
|
| 151 |
=item $p->{wiki} |
=item $p->{wiki} |
| 152 |
|
|
| 153 |
Wiki implementation $p is associated with |
Wiki implementation $p is associated with |
| 161 |
our @ISA = 'Message::Util::Formatter::Node'; |
our @ISA = 'Message::Util::Formatter::Node'; |
| 162 |
require Message::Markup::XML::Node; |
require Message::Markup::XML::Node; |
| 163 |
|
|
| 164 |
sub rule_def ($) { |
sub ___rule_def ($) { |
| 165 |
$SuikaWiki::Plugin::Rule{$_[0]->{-category_name}}; |
$SuikaWiki::Plugin::Rule{$_[0]->{-category_name}} || {}; |
| 166 |
} |
} |
| 167 |
|
|
| 168 |
sub replace_option () {+{ |
sub replace_option () {+{ |
| 169 |
-class => 'Message::Markup::XML::Node', |
-class => 'Message::Markup::XML::Node', |
| 170 |
}} |
}} |
| 171 |
|
|
| 172 |
|
package SuikaWiki::Plugin::text_formatter; |
| 173 |
|
require Message::Util::Formatter::Text; |
| 174 |
|
our @ISA = 'Message::Util::Formatter::Text'; |
| 175 |
|
|
| 176 |
|
sub ___rule_def ($) { |
| 177 |
|
$SuikaWiki::Plugin::Rule{$_[0]->{-category_name}} || {}; |
| 178 |
|
} |
| 179 |
|
|
| 180 |
|
package SuikaWiki::Plugin::boolean_formatter; |
| 181 |
|
require Message::Util::Formatter::Boolean; |
| 182 |
|
our @ISA = 'Message::Util::Formatter::Boolean'; |
| 183 |
|
|
| 184 |
|
sub ___rule_def ($) { |
| 185 |
|
$SuikaWiki::Plugin::Rule{$_[0]->{-category_name}} || {}; |
| 186 |
|
} |
| 187 |
|
|
| 188 |
package SuikaWiki::Plugin::error; |
package SuikaWiki::Plugin::error; |
| 189 |
require Message::Util::Error; |
require Message::Util::Error; |
| 190 |
our @ISA = 'Message::Util::Error'; |
our @ISA = 'Message::Util::Error'; |
| 208 |
|
|
| 209 |
=cut |
=cut |
| 210 |
|
|
| 211 |
sub ___errors () {+{ |
sub ___error_def () {+{ |
| 212 |
PLUGIN_COMPILE_ERROR => { |
PLUGIN_COMPILE_ERROR => { |
| 213 |
description => q(%t(name => method);: %t(name => file);: %t(name => message);), |
description => q(%t(name => method);: %t(name => file);: %t(name => message);), |
| 214 |
}, |
}, |