Plagger::Plugin::Filter::Emoticon - Emoticon Filter


Plagger documentation Contained in the Plagger distribution.

Index


Code Index:

NAME

Top

Plagger::Plugin::Filter::Emoticon - Emoticon Filter

SYNOPSIS

Top

  - module: Filter::Emoticon
    config:
      driver: Yahoo
    option:
      strict: 1
      xhtml: 0

DESCRIPTION

Top

This filter replaces text emoticons like ":-)", ";-P" etc. with Text::Emoticon.

CONFIG

Top

driver

Specify the driver's name of Text::Emoticon you want to use. It defaults to 'MSN'. 'Yahoo' and 'GoogleTalk' are also available.

option

Specify the options you want to pass to the Text::Emoticon.

AUTHOR

Top

Naoya Ito <naoya@bloghackers.net>

SEE ALSO

Top

Plagger, Text::Emoticon


Plagger documentation Contained in the Plagger distribution.

package Plagger::Plugin::Filter::Emoticon;
use strict;
use warnings;
use base qw( Plagger::Plugin );

our $VERSION = 0.01;

use Text::Emoticon;

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

sub filter {
    my($self, $context, $args) = @_;
    my $entry = $args->{entry};
    my $emoticon = Text::Emoticon->new(
        $self->conf->{driver} || 'MSN',
        $self->conf->{option} || {},
    );
    $entry->body($emoticon->filter($entry->body));
}

1;

__END__