/[pub]/suikawiki/script/lib/SuikaWiki/Plugin.pm
Suika

Diff of /suikawiki/script/lib/SuikaWiki/Plugin.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by wakaba, Sat Dec 6 02:20:58 2003 UTC revision 1.14 by wakaba, Wed Mar 10 06:58:10 2004 UTC
# Line 22  our $VERSION = do{my @r=(q$Revision$=~/\ Line 22  our $VERSION = do{my @r=(q$Revision$=~/\
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
# Line 54  sub formatter ($$) { Line 39  sub formatter ($$) {
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.
# Line 87  sub load_directory ($;@) { Line 92  sub load_directory ($;@) {
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
# Line 132  sub new ($;%) { Line 137  sub new ($;%) {
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
# Line 145  require Message::Util::Formatter::Node; Line 161  require Message::Util::Formatter::Node;
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';
# Line 176  WikiPlugin module C<module> not found. Line 208  WikiPlugin module C<module> not found.
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    },    },

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.14

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24