Changeset 14624 for websites

Show
Ignore:
Timestamp:
06/26/08 09:29:50 (5 years ago)
Author:
tomi-ru
Message:

configのマージを忘れていたので追加。あとViewクラスでもpath_to()使うと思い追加してみた

Location:
websites/mobilecat/trunk/lib
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • websites/mobilecat/trunk/lib/Catalyst/View/MobileJpFilter.pm

    r14597 r14624  
    55 
    66use Class::C3; 
     7use Data::Visitor::Callback; 
    78use HTML::MobileJp::Filter; 
    89 
    9 __PACKAGE__->mk_accessors('filter'); 
     10__PACKAGE__->mk_accessors(qw( html_filter )); 
    1011 
    1112sub new { 
    12     my ($class, $c, @args) = @_; 
    13     my $self = $class->next::method($c, @args); 
     13    my ($class, $c, $args) = @_; 
     14      
     15    my $self = $class->next::method($c, $args); 
    1416     
    15     $self->filter(do { 
    16         HTML::MobileJp::Filter->new( filters => $self->config->{filters} );     
    17     });  
     17    $self->config( 
     18        $self->merge_config_hashes($self->config, $args) 
     19    ); 
     20     
     21    my $v = Data::Visitor::Callback->new( 
     22        plain_value => sub { 
     23            return unless defined $_; 
     24            s{__path_to\((.*?)\)__}{ $c->path_to( $1 ? split( /,/, $1 ) : () ) }eg; 
     25        }, 
     26    ); 
     27    $v->visit( $self->config ); 
     28     
     29    $self->html_filter(do { 
     30        HTML::MobileJp::Filter->new( filters => $self->config->{filters} ) 
     31    }); 
    1832     
    1933    $self; 
     
    2337    my ($self, $c) = @_; 
    2438     
    25     my $html = $self->filter->filter( 
     39    my $html = $self->html_filter->filter( 
    2640        mobile_agent => $c->req->mobile_agent, 
    2741        html         => $c->res->body || "", 
  • websites/mobilecat/trunk/lib/MobileCat/View/MobileJpFilter.pm

    r14597 r14624  
    1111  - module: DoCoMoCSS 
    1212    config: 
    13       base_dir: root 
     13      base_dir: __path_to(root)__ 
    1414  - module: DoCoMoGUID  
    1515  - module: EntityReference 
    1616  - module: FallbackImage  
    1717    config: 
    18       template: '<img src="%s" />' 
     18      template: '<img src="%s.gif" />' 
    1919      params: 
    2020        - unicode_hex