Changeset 1118

Show
Ignore:
Timestamp:
07/21/06 16:18:11
Author:
miyagawa
Message:

linting Publish::SWF. I want to take away the Jcode dependency

Files:

Legend:

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

    r1115 r1118  
    77use Jcode; 
    88 
    9  
    10 sub register{ 
    11     my ($self,$context) = @_; 
     9sub register { 
     10    my($self, $context) = @_; 
    1211    $context->register_hook( 
    1312        $self, 
     
    1615} 
    1716 
    18 sub feed
    19     my ($self,$context,$args) = @_; 
     17sub feed
     18    my($self, $context, $args) = @_; 
    2019    my $dir = $self->conf->{dir} || 'swf'; 
    2120    unless (-e $dir && -d _) { 
    2221        mkdir $dir, 0755 or $context->error("mkdir $dir: $!"); 
    2322    } 
     23 
    2424    my $file = File::Spec->catfile($dir, $args->{feed}->id . ".swf"); 
    25     my $id = $args->{feed}->id; 
    26     unless($self->conf->{font}){ 
    27          $context->error("Error font file  $!"); 
     25    unless ($self->conf->{font}) { 
     26         $context->error("'font' config is missing"); 
    2827    } 
    29     my $movie = $self->create_stage($context,$args); 
     28    my $movie = $self->create_stage($context, $args); 
    3029    $movie->save($file); 
    3130    return; 
    3231} 
    3332 
    34 sub convert{ 
    35     my ($self, $str) = @_; 
    36     utf8::decode($str) unless utf8::is_utf8($str); 
    37     return $str; 
    38 
    39  
    40 sub create_stage{ 
    41     my ($self,$context,$args) = @_; 
     33sub create_stage { 
     34    my($self, $context, $args) = @_; 
    4235    my $bgcolor = $self->conf->{bgcolor} || 'ffffff'; 
    4336    my $width = $self->conf->{width} || 500; 
     
    9891    $new_pre_mc->place->name('pre_mc'); 
    9992 
    100     my $page=0; 
     93    my $page = 0; 
    10194    for my $entry ($args->{feed}->entries) { 
    10295        $page++; 
    103         $self->create_page($movie,$page,$entry->title,$entry->body); 
     96        $self->create_page($movie,$page,$entry->title,$entry->body_text); 
    10497    } 
    10598 
     
    107100} 
    108101 
    109 sub create_page()
    110     my ($self,$movie,$page,$title,$body) = @_; 
     102sub create_page
     103    my($self, $movie, $page, $title, $body) = @_; 
    111104    my $font = $self->conf->{font}; 
    112105    my $color = $self->conf->{color} || '000000'; 
     
    114107    my $body_size = $self->conf->{body_size} || 24; 
    115108 
    116     $title = $self->convert($title); 
    117  
    118     $body =~ s/<.+?>//g; 
    119109    $body = $self->linefeed($body); 
    120     $body = $self->convert($body); 
    121110 
    122111    my $entry_name = 'entry_text'.$page; 
     
    141130} 
    142131 
    143 sub linefeed
    144     my ($self,$str,$n)=@_; 
     132sub linefeed
     133    my($self, $str, $n) = @_; 
    145134    my $linefeed = $self->conf->{linefeed} || 30; 
    146135    my @line = split "\n",$str; 
     
    165154=head1 SYNOPSIS 
    166155 
    167 - module: Publish::SWF 
    168    config: 
    169      dir: swf 
    170      font: HONYA-JI.ttf 
    171      color: ff0084 
    172      width: 500 
    173      height: 500 
    174      linefeed: 30 
    175      bgcolor: ffffff 
    176      title_size: 32 
    177      body_size: 24 
     156  - module: Publish::SWF 
     157    config: 
     158      dir: swf 
     159      font: HONYA-JI.ttf 
     160      color: ff0084 
     161      width: 500 
     162      height: 500 
     163      linefeed: 30 
     164      bgcolor: ffffff 
     165      title_size: 32 
     166      body_size: 24 
    178167 
    179168=head1 DESCRIPTION