| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# This code is part of Perl distribution HTML-FromMail version 4.00. |
|
2
|
|
|
|
|
|
|
# The POD got stripped from this file by OODoc version 3.05. |
|
3
|
|
|
|
|
|
|
# For contributors see file ChangeLog. |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# This software is copyright (c) 2003-2025 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 HTML::FromMail::Format::OODoc;{ |
|
13
|
|
|
|
|
|
|
our $VERSION = '4.00'; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
1840
|
use base 'HTML::FromMail::Format'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
437
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
27
|
|
|
19
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
37
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
3
|
use Log::Report 'html-frommail'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
3
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
752
|
use OODoc::Template (); |
|
|
1
|
|
|
|
|
6930
|
|
|
|
1
|
|
|
|
|
727
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#-------------------- |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#----------- |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
|
0
|
1
|
|
sub oodoc() { $_[0]->{HFFM_oodoc} } |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#----------- |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub expand($$$$) |
|
34
|
0
|
|
|
0
|
1
|
|
{ my ($self, $args, $tag, $attrs, $textref) = @_; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Lookup the method to be called. |
|
37
|
0
|
|
|
|
|
|
my $method = 'html' . ucfirst($tag); |
|
38
|
0
|
|
|
|
|
|
my $prod = $args->{producer}; |
|
39
|
0
|
0
|
|
|
|
|
$prod->can($method) or return undef; |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
my %info = (%$args, %$attrs, textref => $textref); |
|
42
|
0
|
|
|
|
|
|
$prod->$method($args->{object}, \%info); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub export($@) |
|
47
|
0
|
|
|
0
|
1
|
|
{ my ($self, $message, %args) = @_; |
|
48
|
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my $oodoc = $self->{HFFM_oodoc} = OODoc::Template->new; |
|
50
|
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $output = $args{output}; |
|
52
|
0
|
0
|
|
|
|
|
open my($out), ">", $output |
|
53
|
|
|
|
|
|
|
or fault __x"cannot write to {out}"; |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $input = $args{input}; |
|
56
|
0
|
0
|
|
|
|
|
open my($in), "<", $input |
|
57
|
|
|
|
|
|
|
or fault __x"cannot open template file {in}", in => $input; |
|
58
|
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $template = join '', <$in>; |
|
60
|
0
|
|
|
|
|
|
close $in; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my %defaults = ( |
|
63
|
0
|
|
|
0
|
|
|
DYNAMIC => sub { $self->expand(\%args, @_) }, |
|
64
|
0
|
|
|
|
|
|
); |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
my $oldout = select $out; |
|
67
|
0
|
|
|
|
|
|
$oodoc->parse($template, \%defaults); |
|
68
|
0
|
|
|
|
|
|
select $oldout; |
|
69
|
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
close $out; |
|
71
|
0
|
|
|
|
|
|
$self; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub containerText($) |
|
75
|
0
|
|
|
0
|
1
|
|
{ my ($self, $args) = @_; |
|
76
|
0
|
|
|
|
|
|
my $textref = $args->{textref}; |
|
77
|
0
|
0
|
|
|
|
|
defined $textref ? $$textref : undef; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub processText($$) |
|
81
|
0
|
|
|
0
|
1
|
|
{ my ($self, $text, $args) = @_; |
|
82
|
0
|
|
|
|
|
|
$self->oodoc->parse($text, {}); |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub lookup($$) |
|
86
|
0
|
|
|
0
|
1
|
|
{ my ($self, $what, $args) = @_; |
|
87
|
0
|
|
|
|
|
|
$self->oodoc->valueFor($what); |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub onFinalToken($) |
|
91
|
0
|
|
|
0
|
1
|
|
{ my ($self, $args) = @_; |
|
92
|
0
|
|
0
|
|
|
|
not (defined $args->{textref} && defined ${$args->{textref}}); |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |