1HTML::Quoted(3) User Contributed Perl Documentation HTML::Quoted(3)
2
3
4
6 HTML::Quoted - extract structure of quoted HTML mail message
7
9 use HTML::Quoted;
10 my $html = '...';
11 my $struct = HTML::Quoted->extract( $html );
12
14 Parses and extracts quotation structure out of a HTML message. Purpose
15 and returned structures are very similar to Text::Quoted.
16
18 Variouse MUAs use quite different approaches for quoting in mails.
19
20 Some use blockquote tag and it's quite easy to parse.
21
22 Some wrap text into p tags and add '>' in the beginning of the
23 paragraphs.
24
25 Things gettign messier when it's an HTML reply on plain text mail
26 thread.
27
28 If you found format that is not supported then file a bug report via
29 rt.cpan.org with as short as possible example. Test file is even
30 better. Test file with patch is the best. Not obviouse patches without
31 tests suck.
32
34 extract
35 my $struct = HTML::Quoted->extract( $html );
36
37 Takes a string with HTML and returns array reference. Each element in
38 the array either array or hash. For example:
39
40 [
41 { 'raw' => 'Hi,' },
42 { 'raw' => '<div><br><div>On date X wrote:<br>' },
43 [
44 { 'raw' => '<blockquote>' },
45 { 'raw' => 'Hello,' },
46 { 'raw' => '<div>How are you?</div>' },
47 { 'raw' => '</blockquote>' }
48 ],
49 ...
50 ]
51
52 Hashes represent a part of the html. The following keys are meaningful
53 at the moment:
54
55 • raw - raw HTML
56
57 • quoter_raw, quoter - raw and decoded (entities are converted)
58 quoter if block is prefixed with quoting characters
59
60 combine_hunks
61 my $html = HTML::Quoted->combine_hunks( $arrayref_of_hunks );
62
63 Takes the output of "extract" and turns it back into HTML.
64
66 Ruslan.Zakirov <ruz@bestpractical.com>
67
69 Under the same terms as perl itself.
70
71
72
73perl v5.34.0 2022-01-21 HTML::Quoted(3)