Plagger::Plugin::Filter::2chNewsokuTitle - Newsokuize entry titles


Plagger documentation Contained in the Plagger distribution.

Index


Code Index:

NAME

Top

Plagger::Plugin::Filter::2chNewsokuTitle - Newsokuize entry titles

SYNOPSIS

Top

  - module: Filter::2chNewsokuTitle

DESCRIPTION

Top

This plugin uses entry tags to be prepended and appended to title, ala 2ch.net Newsoku style. Best used with plugin Filter::BulkfeedsTerms.

AUTHOR

Top

Tatsuhiko Miyagawa

SEE ALSO

Top

Plagger, Plagger::Plugin::Filter::BulkfeedsTerms


Plagger documentation Contained in the Plagger distribution.

package Plagger::Plugin::Filter::2chNewsokuTitle;
use strict;
use base qw( Plagger::Plugin );

sub register {
    my($self, $context) = @_;
    $context->register_hook(
        $self,
        'update.entry.fixup' => \&update,
    );
}

sub update {
    my($self, $context, $args) = @_;

    my $tags  = $args->{entry}->tags;
    my $title = $args->{entry}->title;
    $title = "\x{3010}$tags->[0]\x{3011} " . $title if $tags->[0];
    $title = $title . " \x{3010}$tags->[1]\x{3011}" if $tags->[1];

    $args->{entry}->title($title);
}

1;

__END__