line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2001-2021 by [Mark Overmeer ]. |
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 Mail-Message. 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 Mail::Message::Convert::HtmlFormatText; |
10
|
1
|
|
|
1
|
|
876
|
use vars '$VERSION'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
54
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.011'; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
8
|
use base 'Mail::Message::Convert'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
489
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
16
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
445
|
use Mail::Message::Body::String; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
218
|
use HTML::TreeBuilder; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use HTML::FormatText; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub init($) |
25
|
|
|
|
|
|
|
{ my ($self, $args) = @_; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
$self->SUPER::init($args); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$self->{MMCH_formatter} = HTML::FormatText->new |
30
|
|
|
|
|
|
|
( leftmargin => $args->{leftmargin} // 3, |
31
|
|
|
|
|
|
|
, rightmargin => $args->{rightmargin} // 72, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
$self; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#------------------------------------------ |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub format($) |
41
|
|
|
|
|
|
|
{ my ($self, $body) = @_; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $dec = $body->encode(transfer_encoding => 'none'); |
44
|
|
|
|
|
|
|
my $tree = HTML::TreeBuilder->new_from_file($dec->file); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
(ref $body)->new |
47
|
|
|
|
|
|
|
( based_on => $body |
48
|
|
|
|
|
|
|
, mime_type => 'text/plain' |
49
|
|
|
|
|
|
|
, charset => 'iso-8859-1' |
50
|
|
|
|
|
|
|
, data => [ $self->{MMCH_formatter}->format($tree) ] |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
#------------------------------------------ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |