|
Revision 395
(checked in by miyagawa, 3 years ago)
|
fix POD header
|
| Line | |
|---|
| 1 |
package Plagger::Plugin::Filter::HatenaFormat; |
|---|
| 2 |
use strict; |
|---|
| 3 |
use warnings; |
|---|
| 4 |
use base qw( Plagger::Plugin ); |
|---|
| 5 |
|
|---|
| 6 |
our $VERSION = 0.01; |
|---|
| 7 |
|
|---|
| 8 |
use Text::Hatena; |
|---|
| 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 $parser = Text::Hatena->new(%{$self->conf}); |
|---|
| 22 |
$parser->parse($entry->body); |
|---|
| 23 |
$entry->body($parser->html); |
|---|
| 24 |
} |
|---|
| 25 |
|
|---|
| 26 |
1; |
|---|
| 27 |
|
|---|
| 28 |
__END__ |
|---|
| 29 |
|
|---|
| 30 |
=head1 NAME |
|---|
| 31 |
|
|---|
| 32 |
Plagger::Plugin::Filter::HatenaFormat - Text formatting filter with Hatena Style |
|---|
| 33 |
|
|---|
| 34 |
=head1 SYNOPSIS |
|---|
| 35 |
|
|---|
| 36 |
- module: Filter::HatenaFormat |
|---|
| 37 |
config: |
|---|
| 38 |
ilevel: 1 |
|---|
| 39 |
sectionanchor: '@' |
|---|
| 40 |
|
|---|
| 41 |
=head1 DESCRIPTION |
|---|
| 42 |
|
|---|
| 43 |
This filter allows you to format the content with Hatena Style. You |
|---|
| 44 |
can get html string from simple text with syntax like Wiki. |
|---|
| 45 |
|
|---|
| 46 |
=head1 CONFIG |
|---|
| 47 |
|
|---|
| 48 |
Any configurations will be passed to the constructor of |
|---|
| 49 |
Text::Hatena. See L<Text::Hatena> in detail. |
|---|
| 50 |
|
|---|
| 51 |
=head1 AUTHOR |
|---|
| 52 |
|
|---|
| 53 |
Naoya Ito E<lt>naoya@bloghackers.netE<gt> |
|---|
| 54 |
|
|---|
| 55 |
=head1 SEE ALSO |
|---|
| 56 |
|
|---|
| 57 |
L<Plagger>, L<Text::Hatena> |
|---|
| 58 |
|
|---|
| 59 |
=cut |
|---|