Changeset 559

Show
Ignore:
Timestamp:
04/07/06 20:13:59
Author:
miyagawa
Message:
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/assets/plugins/filter-entryfulltext/nikkansports.yaml

    r525 r559  
    44custom_feed_follow_link: /\w+/[fp]-\w\w-tp\d+-\d{8}-\d+\.html$ 
    55handle: http://[\w\-]+.nikkansports.com/\w+/ 
    6 extract: <h2>.*?</h2>\s*((?:<p>|<!-- \+\+\+\+\+).*?)<p>[(\d{4}年\d\d?月\d\d?日\d\d?時\d\d?分)(?: 紙面から)?]</p> 
    7 extract_capture: body date 
    8 extract_date_format: %Y年%m月%d日%H時%M分 
     6extract: <div id="news">.*?<h2>(.*?)</h2>\s*((?:<p>|<!-- \+\+\+\+\+).*?)<p>[(\d{4}年\d\d?月\d\d?日\d\d?時\d\d?分|\d{4}/\d\d?/\d\d?/\d\d:\d\d)(?: 紙面から)?]</p> 
     7extract_capture: title body date 
     8extract_date_format: 
     9  - %Y年%m月%d日%H時%M分 
     10  - %Y/%m/%d %H:%M 
     11 
  • trunk/plagger/lib/Plagger/Plugin/Filter/EntryFullText.pm

    r556 r559  
    3737    my $dh = DirHandle->new($dir) or $context->error("$dir: $!"); 
    3838    for my $file (grep -f $_->[0] && $_->[0] =~ /\.(?:pl|yaml)$/, 
    39                   map [ File::Spec->catfile($dir, $_), $_ ], $dh->read) { 
     39                  map [ File::Spec->catfile($dir, $_), $_ ], sort $dh->read) { 
    4040        $self->load_plugin(@$file); 
    4141    } 
     
    164164package Plagger::Plugin::Filter::EntryFullText::YAML; 
    165165use Encode; 
     166use List::Util qw(first); 
    166167 
    167168sub new { 
     
    217218 
    218219        if ($data->{date}) { 
    219             if ($self->{extract_date_format}) { 
    220                 $data->{date} = Plagger::Date->strptime($self->{extract_date_format}, $data->{date}); 
     220            if (my $format = $self->{extract_date_format}) { 
     221                $format = [ $format ] unless ref $format; 
     222                $data->{date} = (map { Plagger::Date->strptime($_, $data->{date}) } @$format)[0]; 
    221223            } else { 
    222224                $data->{date} = Plagger::Date->parse_dwim($data->{date});