|
Revision 661
(checked in by miyagawa, 6 years ago)
|
no XML::Simple
|
- Property svn:keywords set to
Id Revision
|
| Line | |
|---|
| 1 |
package Plagger::Plugin::Filter::2chNewsokuTitle; |
|---|
| 2 |
use strict; |
|---|
| 3 |
use base qw( Plagger::Plugin ); |
|---|
| 4 |
|
|---|
| 5 |
use encoding 'utf-8'; |
|---|
| 6 |
use Encode; |
|---|
| 7 |
use Plagger::UserAgent; |
|---|
| 8 |
use URI; |
|---|
| 9 |
|
|---|
| 10 |
sub register { |
|---|
| 11 |
my($self, $context) = @_; |
|---|
| 12 |
$context->register_hook( |
|---|
| 13 |
$self, |
|---|
| 14 |
'update.entry.fixup' => \&update, |
|---|
| 15 |
); |
|---|
| 16 |
} |
|---|
| 17 |
|
|---|
| 18 |
sub update { |
|---|
| 19 |
my($self, $context, $args) = @_; |
|---|
| 20 |
|
|---|
| 21 |
my $tags = $args->{entry}->tags; |
|---|
| 22 |
my $title = $args->{entry}->title; |
|---|
| 23 |
$title = "\x{3010}$tags->[0]\x{3011} " . $title if $tags->[0]; |
|---|
| 24 |
$title = $title . " \x{3010}$tags->[1]\x{3011}" if $tags->[1]; |
|---|
| 25 |
|
|---|
| 26 |
$args->{entry}->title($title); |
|---|
| 27 |
} |
|---|
| 28 |
|
|---|
| 29 |
1; |
|---|
| 30 |
|
|---|
| 31 |
__END__ |
|---|
| 32 |
|
|---|
| 33 |
=head1 NAME |
|---|
| 34 |
|
|---|
| 35 |
Plagger::Plugin::Filter::2chNewsokuTitle - Newsokuize entry titles |
|---|
| 36 |
|
|---|
| 37 |
=head1 SYNOPSIS |
|---|
| 38 |
|
|---|
| 39 |
- module: Filter::2chNewsokuTitle |
|---|
| 40 |
|
|---|
| 41 |
=head1 DESCRIPTION |
|---|
| 42 |
|
|---|
| 43 |
This plugin uses entry tags to be prepended and appended to title, ala |
|---|
| 44 |
2ch.net Newsoku style. Best used with plugin Filter::BulkfeedsTerms. |
|---|
| 45 |
|
|---|
| 46 |
=head1 AUTHOR |
|---|
| 47 |
|
|---|
| 48 |
Tatsuhiko Miyagawa |
|---|
| 49 |
|
|---|
| 50 |
=head1 SEE ALSO |
|---|
| 51 |
|
|---|
| 52 |
L<Plagger>, L<Plagger::Plugin::Filter::BulkfeedsTerms> |
|---|
| 53 |
|
|---|
| 54 |
=cut |
|---|