Contentment::Generator::HTML - Generator for HTML text
my $generator = Contentment::Generator::HTML->new({ source => <<'END_OF_HTML', <html> <head> <title>This is an example.</title> <meta name="foo" content="1"/> <meta name="bar" content="2"/> </head> <body> <h1>This is an example.</h1> <p>Exampling we will go! Exampling we will go!<br/> Hi-Ho-A-Merry-Oh! Exampling we will go!</p> </body> </html> END_OF_HTML
This is a generator for HTML files. It basically understands the title and meta tags. It strips the body out of the HTML and passes it on. This way, each HTML file is a complete file in and of itself, but we can wrap it in nice themes without too much effort.
title
meta
Constructs an HTML generator. It accepts the following arguments:
This is the HTML text to generate. It takes the same forms as Contentment::Generator::Plain's constructor.
The get_property() method searches for meta-tags in the HTML source and uses those as properties. If you wish to have additional properties that aren't defined in the meta tags, you may add them with this option. These options create additional properties, they do not override the meta tags in the file.
get_property()
This decodes the properties found defined by meta-tags in the source as well as returning any properties set in the constructor. The meta-tags in the file will override any properties given to the constructor.
Parses the HTML and it's properties in addition to reading the source.
Returns the contents of the title tag when $key is "title".
$key
Returns the contents of the content attribute of any meta tag where the key matches the given $key.
content
Prints the body of the HTML file.
Handles the "Contentment::FileType::match" hook.
Contentment::FileType::Other
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
Contentment is distributed and licensed under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head2'
To install Contentment, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Contentment
CPAN shell
perl -MCPAN -e shell install Contentment
For more information on module installation, please visit the detailed CPAN module installation guide.