Changeset 1639

Show
Ignore:
Timestamp:
09/02/06 02:09:00
Author:
miyagawa
Message:

Subscription::XPath: allow non-absolute link ... even if it sounds weird

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Subscription/XPath.pm

    r756 r1639  
    2626    $tree->eof; 
    2727 
    28     $self->find_feed($tree); 
     28    $self->find_feed($tree, $uri); 
    2929} 
    3030 
    3131sub find_feed { 
    32     my($self, $tree) = @_; 
     32    my($self, $tree, $uri) = @_; 
    3333    for my $child ($tree->findnodes($self->conf->{xpath} || '//a')) { 
    3434        my $href  = $child->attr('href') or next; 
     
    3636 
    3737        my $feed = Plagger::Feed->new; 
    38         $feed->url($href); 
     38        $feed->url( URI->new_abs($href, $uri) ); 
    3939        $feed->title($title); 
    4040 
  • trunk/plagger/t/plugins/Subscription-XPath/subscription.t

    r1413 r1639  
    33 
    44test_plugin_deps; 
    5 plan tests => 1
     5plan tests => 2
    66run_eval_expected; 
    77 
     
    2424      'http://subtech.g.hatena.ne.jp/miyagawa/'] 
    2525); 
     26 
     27=== test with relative link path 
     28--- input config 
     29plugins: 
     30  - module: Subscription::XPath 
     31    config: 
     32      url: file://$t::TestPlagger::BaseDirURI/t/samples/xoxo-relative.html 
     33      xpath: //a 
     34  - module: Aggregator::Null 
     35--- expected 
     36is $context->subscription->feeds->[0]->url, "file://$t::TestPlagger::BaseDirURI/t/samples/foo.html";