1HTML::FormatText::WithLUisnekrs:C:oAnntdrTiabbulteesdH(T3PM)eLr:l:FDoorcmuamteTnetxatt:i:oWnithLinks::AndTables(3)
2
3
4
6 HTML::FormatText::WithLinks::AndTables - Converts HTML to Text with
7 tables in tact
8
10 Version 0.01
11
13 use HTML::FormatText::WithLinks::AndTables;
14
15 my $text = HTML::FormatText::WithLinks::AndTables->convert($html);
16
17 Or optionally...
18
19 my $conf = { # same as HTML::FormatText excepting below
20 cellpadding => 2, # defaults to 1
21 no_rowspacing => 1, # bool, suppress vertical space between table rows
22 };
23
24 my $text = HTML::FormatText::WithLinks::AndTables->convert($html, $conf);
25
27 This module was inspired by HTML::FormatText::WithLinks which has
28 proven to be a useful `lynx -dump` work-alike. However one frustration
29 was that no other HTML converters I came across had the ability to deal
30 affectively with HTML <TABLE>s. This module can in a rudimentary sense
31 do so. The aim was to provide facility to take a simple HTML based
32 email template, and to also convert it to text with the <TABLE>
33 structure in tact for inclusion as "multipart/alternative" content.
34 Further, it will preserve both the formatting specified by the <TD>
35 tag's "align" attribute, and will also preserve multiline text inside
36 of a <TD> element provided it is broken using <BR/> tags.
37
38 EXPORT
39 None by default.
40
42 convert
44 Given the HTML below ...
45
46 <HTML><BODY>
47 <TABLE>
48 <TR>
49 <TD ALIGN="right">Name:</TD>
50 <TD>Mr. Foo Bar</TD>
51 </TR>
52 <TR>
53 <TD ALIGN="right">Address:</TD>
54 <TD>
55 #1-276 Quux Lane, <BR/>
56 Schenectady, NY, USA, <BR/>
57 12345
58 </TD>
59 </TR>
60 <TR>
61 <TD ALIGN="right">Email:</TD>
62 <TD><a href="mailto:foo@bar.baz">foo@bar.baz</a></TD>
63 </TR>
64 </TABLE>
65 </BODY></HTML>
66
67 ... the (default) return value of convert() will be as follows.
68
69 Name: Mr. Foo Bar
70
71 Address: #1-276 Quux Lane,
72 Schenectady, NY, USA,
73 12345
74
75 Email: [1]foo@bar.baz
76
77
78
79 1. mailto:foo@bar.baz
80
82 HTML::FormatText::WithLinks
83 HTML::TreeBuilder
84
86 * This does not handle <TH> elements whatsoever!
87
88 * It assumes a fixed width font for display of resulting text.
89
90 * It doesn't work well on nested <TABLE>s or other nested blocks within <TABLE>s.
91
93 Shaun Fryer, "<pause.cpan.org at sourcery.ca>"
94
96 Please report any bugs or feature requests to
97 "bug-html-formattext-withlinks-andtables at rt.cpan.org", or through
98 the web interface at
99 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTML-FormatText-WithLinks-AndTables>.
100 I will be notifi ed, and then you'll automatically be notified of
101 progress on your bug as I make changes.
102
104 You can find documentation for this module with the perldoc command.
105
106 perldoc HTML::FormatText::WithLinks::AndTables
107
108 You can also look for information at:
109
110 · RT: CPAN's request tracker
111
112 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-FormatText-WithLinks-AndTables>
113
114 · AnnoCPAN: Annotated CPAN documentation
115
116 <http://annocpan.org/dist/HTML-FormatText-WithLinks-AndTables>
117
118 · CPAN Ratings
119
120 <http://cpanratings.perl.org/d/HTML-FormatText-WithLinks-AndTables>
121
122 · Search CPAN
123
124 <http://search.cpan.org/dist/HTML-FormatText-WithLinks-AndTables>
125
127 Everybody. :)
128 <http://en.wikipedia.org/wiki/Standing_on_the_shoulders_of_giants>
129
131 Copyright 2008 Shaun Fryer, all rights reserved.
132
133 This program is free software; you can redistribute it and/or modify it
134 under the same terms as Perl itself.
135
136
137
138perl v5.16.3 2014H-T0M6L-:1:0FormatText::WithLinks::AndTables(3)