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 intact
8
10 version 0.07
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 intact 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 * <TH> elements are treated identically to <TD> elements
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>" (author emeritus)
94
95 Dale Evans, "<daleevans at cpan.org>" (current maintainer)
96
98 Please report any bugs or feature requests to
99 "bug-html-formattext-withlinks-andtables at rt.cpan.org", or through
100 the web interface at
101 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTML-FormatText-WithLinks-AndTables>.
102 I will be notified, and then you'll automatically be notified of
103 progress on your bug as I make changes.
104
106 You can find documentation for this module with the perldoc command.
107
108 perldoc HTML::FormatText::WithLinks::AndTables
109
110 You can also look for information at:
111
112 • RT: CPAN's request tracker
113
114 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-FormatText-WithLinks-AndTables>
115
116 • AnnoCPAN: Annotated CPAN documentation
117
118 <http://annocpan.org/dist/HTML-FormatText-WithLinks-AndTables>
119
120 • CPAN Ratings
121
122 <http://cpanratings.perl.org/d/HTML-FormatText-WithLinks-AndTables>
123
124 • Search CPAN
125
126 <http://search.cpan.org/dist/HTML-FormatText-WithLinks-AndTables>
127
129 Everybody. :)
130 <http://en.wikipedia.org/wiki/Standing_on_the_shoulders_of_giants>
131
133 Copyright 2008 Shaun Fryer, all rights reserved.
134
135 Copyright 2015 Dale Evans, all rights reserved
136
137 This program is free software; you can redistribute it and/or modify it
138 under the same terms as Perl itself.
139
140
141
142perl v5.38.0 2023H-T0M7L-:2:0FormatText::WithLinks::AndTables(3)