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