/[pub]/suikawiki/script/lib/SuikaWiki/View/Implementation.pm
Suika

Diff of /suikawiki/script/lib/SuikaWiki/View/Implementation.pm

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

revision 1.1 by wakaba, Sun Oct 5 11:55:29 2003 UTC revision 1.2 by wakaba, Sat Oct 18 07:08:34 2003 UTC
# Line 33  sub select ($$$) { Line 33  sub select ($$$) {
33    my @views;    my @views;
34    VIEW: for my $view (@$views) {    VIEW: for my $view (@$views) {
35      my $point = 0;      my $point = 0;
36      for (keys %{$view->{condition}}) {      COND: for (keys %{$view->{condition}}) {
37        next if $_ eq 'mode';        next if $_ eq 'mode';
38        if ($opt->{condition}->{$_} eq $view->{condition}->{$_}) {        if (ref ($view->{condition}->{$_}) eq 'ARRAY') {
39            for my $item (@{$view->{condition}->{$_}}) {
40              if ($item eq $opt->{condition}->{$_}) {
41                $point++;
42                next COND;
43              }
44            }
45            next VIEW; # no match
46          } elsif ($opt->{condition}->{$_} eq $view->{condition}->{$_}) {
47          $point++;          $point++;
48        } else {        } else {
49          next VIEW;          next VIEW; # no match
50        }        }
51      }      }
52      $views[$point] ||= [];      $views[$point] ||= [];
# Line 95  sub register_common_modes ($) { Line 103  sub register_common_modes ($) {
103    }    }
104  }  }
105    
106    our %TemplateFragment;
107    sub assemble_template ($$) {
108      my ($self, $name) = @_;
109      join '',
110        map {$_->{Main}}
111        sort {$a->{Order} <=> $b->{Order}}
112        @{$TemplateFragment{$name}||{}};
113    }
114    
115  =item $v->{definition}->{ $mode } = [{ condition => {mode => $mode,...}, ... },...]  =item $v->{definition}->{ $mode } = [{ condition => {mode => $mode,...}, ... },...]
116    
117  =item $v->{wiki}  =item $v->{wiki}
# Line 114  sub new ($%) { Line 131  sub new ($%) {
131    
132  sub main ($$) {  sub main ($$) {
133    my ($self, $opt) = @_;    my ($self, $opt) = @_;
134      my $opt2 = {};
135      $self->main_pre ($opt, $opt2)
136        &&
137      1
138        &&
139      $self->main_post ($opt, $opt2);
140    }
141    
142    sub main_pre ($$$) {
143      1;
144    }
145    
146    sub main_post ($$$) {
147      1;
148  }  }
149    
150  =head1 LICENSE  =head1 LICENSE

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

[email protected]
ViewVC Help
Powered by ViewVC 1.1.24