|
Revision 19129, 0.8 kB
(checked in by mattn, 10 months ago)
|
|
added Filter::Gal
|
| Line | |
|---|
| 1 | package Plagger::Plugin::Filter::Gal; |
|---|
| 2 | use strict; |
|---|
| 3 | use base qw( Plagger::Plugin ); |
|---|
| 4 | |
|---|
| 5 | use Lingua::JA::Gal; |
|---|
| 6 | |
|---|
| 7 | sub register { |
|---|
| 8 | my($self, $context) = @_; |
|---|
| 9 | |
|---|
| 10 | $context->register_hook( |
|---|
| 11 | $self, |
|---|
| 12 | 'update.entry.fixup' => \&filter |
|---|
| 13 | ); |
|---|
| 14 | } |
|---|
| 15 | |
|---|
| 16 | sub filter { |
|---|
| 17 | my($self, $context, $args) = @_; |
|---|
| 18 | |
|---|
| 19 | my $entry = $args->{entry}; |
|---|
| 20 | $entry->body( Lingua::JA::Gal->gal( |
|---|
| 21 | $entry->body_text, { rate => $self->conf->{rate} || 100 }) ); |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | 1; |
|---|
| 25 | __END__ |
|---|
| 26 | |
|---|
| 27 | =head1 NAME |
|---|
| 28 | |
|---|
| 29 | Plagger::Plugin::Filter::Gal - Filter body text like Gal |
|---|
| 30 | |
|---|
| 31 | =head1 SYNOPSIS |
|---|
| 32 | |
|---|
| 33 | - module: Filter::Gal |
|---|
| 34 | config: |
|---|
| 35 | username: your-username |
|---|
| 36 | |
|---|
| 37 | =head1 DESCRIPTION |
|---|
| 38 | |
|---|
| 39 | Filter body text like Gal using Lingua::JA::Gal |
|---|
| 40 | |
|---|
| 41 | =head1 CONFIG |
|---|
| 42 | |
|---|
| 43 | =over 4 |
|---|
| 44 | |
|---|
| 45 | =item rate |
|---|
| 46 | |
|---|
| 47 | rate for converting. default is 100. |
|---|
| 48 | |
|---|
| 49 | =back |
|---|
| 50 | |
|---|
| 51 | =head1 AUTHOR |
|---|
| 52 | |
|---|
| 53 | Yasuhiro MATSUMOTO |
|---|
| 54 | |
|---|
| 55 | =head1 SEE ALSO |
|---|
| 56 | |
|---|
| 57 | L<Plagger>, L<Lingua::JA::Gal> |
|---|
| 58 | |
|---|
| 59 | =cut |
|---|