| 1 | # Copyrights 2003-2018 by [Mark Overmeer <markov@cpan.org>]. | ||
| 2 | # For other contributors see ChangeLog. | ||
| 3 | # See the manual pages for details on the licensing terms. | ||
| 4 | # Pod stripped from pm file by OODoc 2.02. | ||
| 5 | # This code is part of distribution HTML-FromMail. Meta-POD processed with | ||
| 6 | # OODoc into POD and HTML manual-pages. See README.md | ||
| 7 | # Copyright Mark Overmeer. Licensed under the same terms as Perl itself. | ||
| 8 | |||
| 9 | package HTML::FromMail::Default::HTMLifiers; | ||
| 10 | use vars '$VERSION'; | ||
| 11 | $VERSION = '0.12'; | ||
| 12 | |||
| 13 | |||
| 14 | use strict; | ||
| 15 | use warnings; | ||
| 16 | |||
| 17 | use HTML::FromText; | ||
| 18 | use Carp; | ||
| 19 | |||
| 20 | |||
| 21 | our @htmlifiers = | ||
| 22 | ( 'text/plain' => \&htmlifyText | ||
| 23 | #, 'text/html' => \&htmlifyHtml | ||
| 24 | ); | ||
| 25 | |||
| 26 | |||
| 27 | sub htmlifyText($$$$) | ||
| 28 | { my ($page, $message, $part, $args) = @_; | ||
| 29 | my $main = $args->{main} or confess; | ||
| 30 | my $settings = $main->settings('HTML::FromText') | ||
| 31 | || { pre => 1, urls => 1, email => 1, bold => 1, underline => 1}; | ||
| 32 | |||
| 33 | my $f = HTML::FromText->new($settings) | ||
| 34 | or croak "Cannot create an HTML::FromText object"; | ||
| 35 | |||
| 36 | { image => '' # this is not an image | ||
| 37 | , html => { text => $f->parse($part->decoded->string) | ||
| 38 | } | ||
| 39 | } | ||
| 40 | } | ||
| 41 | |||
| 42 | |||
| 43 | 1; |