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 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTML-FormatText-
101 WithLinks-AndTables>. I will be notifi ed, and then you'll
102 automatically be notified of progress on your bug as I make changes.
103
105 You can find documentation for this module with the perldoc command.
106
107 perldoc HTML::FormatText::WithLinks::AndTables
108
109 You can also look for information at:
110
111 · RT: CPAN's request tracker
112
113 http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-FormatText-WithLinks-AndTables
114 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-FormatText-
115 WithLinks-AndTables>
116
117 · AnnoCPAN: Annotated CPAN documentation
118
119 http://annocpan.org/dist/HTML-FormatText-WithLinks-AndTables
120 <http://annocpan.org/dist/HTML-FormatText-WithLinks-AndTables>
121
122 · CPAN Ratings
123
124 http://cpanratings.perl.org/d/HTML-FormatText-WithLinks-AndTables
125 <http://cpanratings.perl.org/d/HTML-FormatText-WithLinks-AndTables>
126
127 · Search CPAN
128
129 http://search.cpan.org/dist/HTML-FormatText-WithLinks-AndTables
130 <http://search.cpan.org/dist/HTML-FormatText-WithLinks-AndTables>
131
133 Everybody. :)
134 <http://en.wikipedia.org/wiki/Standing_on_the_shoulders_of_giants>
135
137 Copyright 2008 Shaun Fryer, all rights reserved.
138
139 This program is free software; you can redistribute it and/or modify it
140 under the same terms as Perl itself.
141
142
143
144perl v5.12.3 2008H-T1M2L-:1:0FormatText::WithLinks::AndTables(3)