1HTML::Formatter(3)    User Contributed Perl Documentation   HTML::Formatter(3)
2
3
4

NAME

6       HTML::Formatter - Base class for HTML formatters
7

VERSION

9       version 2.16
10

SYNOPSIS

12         use HTML::FormatSomething;
13         my $infile  = "whatever.html";
14         my $outfile = "whatever.file";
15         open OUT, ">$outfile"
16          or die "Can't write-open $outfile: $!\n";
17
18         print OUT HTML::FormatSomething->format_file(
19           $infile,
20             'option1' => 'value1',
21             'option2' => 'value2',
22             ...
23         );
24         close(OUT);
25

DESCRIPTION

27       HTML::Formatter is a base class for classes that take HTML and format
28       it to some output format.  When you take an object of such a base class
29       and call "$formatter-"format( $tree )> with an HTML::TreeBuilder (or
30       HTML::Element) object, they return the appropriately formatted string
31       for the input HTML.
32
33       HTML formatters are able to format a HTML syntax tree into various
34       printable formats.  Different formatters produce output for different
35       output media.  Common for all formatters are that they will return the
36       formatted output when the format() method is called.  The format()
37       method takes a HTML::Element object (usually the HTML::TreeBuilder root
38       object) as parameter.
39
40       The distribution name has been changed to "HTML-Formatter" as detailed
41       in "DISTRIBUTION NAME"
42

METHODS

44   new
45           my $formatter = FormatterClass->new(
46               option1 => value1, option2 => value2, ...
47           );
48
49       This creates a new formatter object with the given options.
50
51   format_file
52   format_from_file
53           $string = FormatterClass->format_file(
54               $html_source,
55               option1 => value1, option2 => value2, ...
56               );
57
58       Return a string consisting of the result of using the given class to
59       format the given HTML file according to the given (optional) options.
60       Internally it calls "SomeClass->new( ... )->format( ... )" on a new
61       HTML::TreeBuilder object based on the given HTML file.
62
63   format_string
64   format_from_string
65           $string = FormatterClass->format_string(
66               $html_source,
67               option1 => value1, option2 => value2, ...
68               );
69
70       Return a string consisting of the result of using the given class to
71       format the given HTML source according to the given (optional) options.
72       Internally it calls "SomeClass->new( ... )->format( ... )" on a new
73       HTML::TreeBuilder object based on the given source.
74
75   format
76           my $render_string = $formatter->format( $html_tree_object );
77
78       This renders the given HTML object according to the options set for
79       $formatter.
80
81       After you've used a particular formatter object to format a particular
82       HTML tree object, you probably should not use either again.
83

DISTRIBUTION NAME

85       This module was originally named "HTML-Format" despite not containing a
86       "HTML::Format" module within it.  As rules on naming have been taken
87       more seriously, and the PAUSE <https://pause.perl.org/> toolchain
88       adapted so that getting the distribution indexed was more difficult, it
89       became obvious that I should rename the distribution to
90       "HTML-Formatter" matching the base HTML::Formatter module.
91
92       As of release 2.13 this is released as the "HTML-Formatter"
93       distribution with corresponding changes to the git repository name and
94       associated items.
95
96       Due to the way that the module is put together this should have no
97       effect on code using the module.  The only issues will be where the
98       distribution name was used within dependancies.
99

SEE ALSO

101       The three specific formatters:-
102
103       HTML::FormatText
104           Format HTML into plain text
105
106       HTML::FormatPS
107           Format HTML into postscript
108
109       HTML::FormatRTF
110           Format HTML into Rich Text Format
111
112       Also the HTML manipulation libraries used - HTML::TreeBuilder,
113       HTML::Element and HTML::Tree
114

SUPPORT

116   Bugs / Feature Requests
117       Please report any bugs or feature requests through the issue tracker at
118       <http://rt.cpan.org/Public/Dist/Display.html?Name=HTML-Formatter>.  You
119       will be notified automatically of any progress on your issue.
120
121   Source Code
122       This is open source software.  The code repository is available for
123       public review and contribution under the terms of the license.
124
125       <https://github.com/nigelm/html-formatter>
126
127         git clone https://github.com/nigelm/html-formatter.git
128

AUTHORS

130       •   Nigel Metheringham <nigelm@cpan.org>
131
132       •   Sean M Burke <sburke@cpan.org>
133
134       •   Gisle Aas <gisle@ActiveState.com>
135
137       This software is copyright (c) 2016 by Nigel Metheringham, 2002-2005
138       Sean M Burke, 1999-2002 Gisle Aas.
139
140       This is free software; you can redistribute it and/or modify it under
141       the same terms as the Perl 5 programming language system itself.
142
143
144
145perl v5.38.0                      2023-07-20                HTML::Formatter(3)
Impressum