line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2001-2023 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.03. |
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
|
|
900
|
use vars '$VERSION'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
56
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.013'; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
7
|
use base 'Mail::Message::Convert'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
465
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
16
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
416
|
use Mail::Message::Body::String; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
203
|
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; |