| 1 | # This code is part of Perl distribution Mail-Message version 4.05. | ||||||||||||||||||||||
| 2 | # The POD got stripped from this file by OODoc version 3.06. | ||||||||||||||||||||||
| 3 | # For contributors see file ChangeLog. | ||||||||||||||||||||||
| 4 | |||||||||||||||||||||||
| 5 | # This software is copyright (c) 2001-2026 by Mark Overmeer. | ||||||||||||||||||||||
| 6 | |||||||||||||||||||||||
| 7 | # This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||
| 8 | # the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||
| 9 | # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later | ||||||||||||||||||||||
| 10 | |||||||||||||||||||||||
| 11 | |||||||||||||||||||||||
| 12 | package Mail::Message::Convert::HtmlFormatText;{ | ||||||||||||||||||||||
| 13 | 2 | our $VERSION = '4.05'; | |||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||
| 15 | |||||||||||||||||||||||
| 16 | 2 | ▶ | use parent 'Mail::Message::Convert'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 17 | |||||||||||||||||||||||
| 18 | 2 | ▶ | use strict; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 19 | 2 | ▶ | use warnings; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 20 | |||||||||||||||||||||||
| 21 | 2 | ▶ | use Log::Report 'mail-message', import => [ qw// ]; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 22 | |||||||||||||||||||||||
| 23 | 2 | ▶ | use HTML::TreeBuilder (); | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 24 | 2 | ▶ | use HTML::FormatText (); | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 25 | |||||||||||||||||||||||
| 26 | 2 | ▶ | use Mail::Message::Body::String (); | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 27 | |||||||||||||||||||||||
| 28 | #-------------------- | ||||||||||||||||||||||
| 29 | |||||||||||||||||||||||
| 30 | sub init($) | ||||||||||||||||||||||
| 31 | 2 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||
|
Subroutine
init: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||
| 32 | 2 | $self->SUPER::init($args); | |||||||||||||||||||||
| 33 | |||||||||||||||||||||||
| 34 | $self->{MMCH_formatter} = HTML::FormatText->new( | ||||||||||||||||||||||
| 35 | leftmargin => $args->{leftmargin} // 3,, | ||||||||||||||||||||||
| 36 | 2 | ▶ | rightmargin => $args->{rightmargin} // 72, | ||||||||||||||||||||
|
Condition50%2/4
$args->{"leftmargin"} // 3
$args->{"rightmargin"} // 72
MC/DC0%0/1
$args->{"leftmargin"} // 3
$args->{"leftmargin"}
MC/DC0%0/1
$args->{"rightmargin"} // 72
$args->{"rightmargin"}
Truth table50%1/2
A
A= $args->{"leftmargin"}
Truth table50%1/2
A
A= $args->{"rightmargin"}
| |||||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||||
| 38 | |||||||||||||||||||||||
| 39 | 2 | $self; | |||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||
| 41 | |||||||||||||||||||||||
| 42 | #-------------------- | ||||||||||||||||||||||
| 43 | |||||||||||||||||||||||
| 44 | sub format($) | ||||||||||||||||||||||
| 45 | 2 | ▶ | { my ($self, $body) = @_; | ||||||||||||||||||||
|
Subroutine
format: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||
| 46 | |||||||||||||||||||||||
| 47 | 2 | my $dec = $body->encode(transfer_encoding => 'none'); | |||||||||||||||||||||
| 48 | 2 | my $tree = HTML::TreeBuilder->new_from_file($dec->file); | |||||||||||||||||||||
| 49 | |||||||||||||||||||||||
| 50 | (ref $body)->new( | ||||||||||||||||||||||
| 51 | based_on => $body, | ||||||||||||||||||||||
| 52 | mime_type => 'text/plain', | ||||||||||||||||||||||
| 53 | charset => 'iso-8859-1', | ||||||||||||||||||||||
| 54 | 2 | data => [ $self->{MMCH_formatter}->format($tree) ], | |||||||||||||||||||||
| 55 | ); | ||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||
| 57 | |||||||||||||||||||||||
| 58 | 2 | 1; | |||||||||||||||||||||