Changeset 1721

Show
Ignore:
Timestamp:
10/06/06 11:59:52
Author:
miyagawa
Message:

Publish::PDF accepts filename parameter

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Publish/PDF.pm

    r1720 r1721  
    55use File::Spec; 
    66use PDF::FromHTML; 
     7use Plagger::Util; 
    78 
    89sub register { 
     
    2223    } 
    2324 
    24     my $file = File::Spec->catfile($dir, $args->{feed}->id . ".pdf"); 
     25    my $file = Plagger::Util::filename_for($args->{feed}, $self->conf->{filename} || '%i.pdf'); 
     26    my $path = File::Spec->catfile($dir, $file); 
    2527    my $body = $self->templatize('html.tt', $args); 
    2628    utf8::encode($body); 
    2729 
    28     $context->log(info => "Writing PDF to $file"); 
     30    $context->log(info => "Writing PDF to $path"); 
    2931 
    3032    my $pdf = PDF::FromHTML->new; 
    3133    $pdf->load_file(\$body); 
    3234    $pdf->convert(); 
    33     $pdf->write_file($file); 
     35    $pdf->write_file($path); 
    3436} 
    3537