root/trunk/plagger/lib/Plagger/Plugin/Filter/Emoticon.pm

Revision 389 (checked in by naoya, 15 years ago)

fixed typo on AmazonAssociateReportJP / added pod to Filter::Emoticon and CustomFeed?::Debug

Line 
1 package Plagger::Plugin::Filter::Emoticon;
2 use strict;
3 use warnings;
4 use base qw( Plagger::Plugin );
5
6 our $VERSION = 0.01;
7
8 use Text::Emoticon;
9
10 sub register {
11     my($self, $context) = @_;
12     $context->register_hook(
13         $self,
14         'update.entry.fixup' => \&filter,
15     );
16 }
17
18 sub filter {
19     my($self, $context, $args) = @_;
20     my $entry = $args->{entry};
21     my $emoticon = Text::Emoticon->new(
22         $self->conf->{driver} || 'MSN',
23         $self->conf->{option} || {},
24     );
25     $entry->body($emoticon->filter($entry->body));
26 }
27
28 1;
29
30 __END__
31
32 =head1 NAME
33
34 Plagger::Plugin::Filter::Emoticon - Emoticon Filter
35
36 =head1 SYNOPSIS
37
38   - module: Filter::Emoticon
39     config:
40       driver: Yahoo
41     option:
42       strict: 1
43       xhtml: 0
44
45 =head1 DESCRIPTION
46
47 This filter replaces text emoticons like ":-)", ";-P" etc. with
48 L<Text::Emoticon>.
49
50 =head1 CONFIG
51
52 =over 4
53
54 =item driver
55
56 Specify the driver's name of L<Text::Emoticon> you want to use. It
57 defaults to 'MSN'. 'Yahoo' and 'GoogleTalk' are also available.
58
59 =item option
60
61 Specify the options you want to pass to the L<Text::Emoticon>.
62
63 =back
64
65 =head1 AUTHOR
66
67 Naoya Ito E<lt>naoya@bloghackers.netE<gt>
68
69 =head1 SEE ALSO
70
71 L<Plagger>, L<Text::Emoticon>
72
73 =cut
Note: See TracBrowser for help on using the browser.