[%#
# IMPORTANT NOTE
# This documentation is generated automatically from source
# templates. Any changes you make here may be lost.
#
# The 'docsrc' documentation source bundle is available for download
# from http://www.template-toolkit.org/docs.html and contains all
# the source templates, XML files, scripts, etc., from which the
# documentation for the Template Toolkit is built.
-%]
[% META book = 'Modules'
page = 'Plugin_HTML'
%]
[% WRAPPER toc;
PROCESS tocitem
title ="SYNOPSIS"
subs = [];
PROCESS tocitem
title ="DESCRIPTION"
subs = [];
PROCESS tocitem
title ="METHODS"
subs = [
"escape(text)",
"attributes(hash)",
"element(type, attributes)"
];
PROCESS tocitem
title ="DEBUGGING"
subs = [];
PROCESS tocitem
title ="AUTHOR"
subs = [];
PROCESS tocitem
title ="VERSION"
subs = [];
PROCESS tocitem
title ="COPYRIGHT"
subs = [];
PROCESS tocitem
title ="SEE ALSO"
subs = [];
END
%]
<!-- Pod to HTML conversion by the Template Toolkit version 2 -->
[% WRAPPER section
title="SYNOPSIS"
-%]<pre> [% tt_start_tag %] USE HTML [% tt_end_tag %]</pre>
<pre> [% tt_start_tag %] HTML.escape("if (a < b && c > d) ..." [% tt_end_tag %]</pre>
<pre> [% tt_start_tag %] HTML.element(table => { border => 1, cellpadding => 2 }) [% tt_end_tag %]</pre>
<pre> [% tt_start_tag %] HTML.attributes(border => 1, cellpadding => 2) [% tt_end_tag %]</pre>
[%- END %]
[% WRAPPER section
title="DESCRIPTION"
-%]<p>
The HTML plugin is very new and very basic, implementing a few useful
methods for generating HTML. It is likely to be extended in the future
or integrated with a larger project to generate HTML elements in a generic
way (as discussed recently on the mod_perl mailing list).
</p>
[%- END %]
[% WRAPPER section
title="METHODS"
-%][% WRAPPER subsection
title = "escape(text)"
-%]<p>
Returns the source text with any HTML reserved characters such as
<, >, etc., correctly esacped to their entity equivalents.
</p>
[%- END %]
[% WRAPPER subsection
title = "attributes(hash)"
-%]<p>
Returns the elements of the hash array passed by reference correctly
formatted (e.g. values quoted and correctly escaped) as attributes for
an HTML element.
</p>
[%- END %]
[% WRAPPER subsection
title = "element(type, attributes)"
-%]<p>
Generates an HTML element of the specified type and with the attributes
provided as an optional hash array reference as the second argument or
as named arguments.
</p>
<pre> [% tt_start_tag %] HTML.element(table => { border => 1, cellpadding => 2 }) [% tt_end_tag %]
[% tt_start_tag %] HTML.element('table', border=1, cellpadding=2) [% tt_end_tag %]
[% tt_start_tag %] HTML.element(table => attribs) [% tt_end_tag %]</pre>
[%- END %]
[%- END %]
[% WRAPPER section
title="DEBUGGING"
-%]<p>
The HTML plugin accepts a 'sorted' option as a constructor argument
which, when set to any true value, causes the attributes generated by
the attributes() method (either directly or via element()) to be
returned in sorted order. Order of attributes isn't important in
HTML, but this is provided mainly for the purposes of debugging where
it is useful to have attributes generated in a deterministic order
rather than whatever order the hash happened to feel like returning
the keys in.
</p>
<pre> [% tt_start_tag %] USE HTML(sorted=1) [% tt_end_tag %]
[% tt_start_tag %] HTML.element( foo => { charlie => 1, bravo => 2, alpha => 3 } ) [% tt_end_tag %]</pre>
<p>
generates:
</p>
<pre> <foo alpha="3" bravo="2" charlie="1"></pre>
[%- END %]
[% WRAPPER section
title="AUTHOR"
-%]<p>
Andy Wardley <abw@wardley.org>
</p>
<p>
[% ttlink('http://wardley.org/', 'http://wardley.org/') -%]
</p>
[%- END %]
[% WRAPPER section
title="VERSION"
-%]<p>
2.62, distributed as part of the
Template Toolkit version 2.19, released on 27 April 2007.
</p>
[%- END %]
[% WRAPPER section
title="COPYRIGHT"
-%]<pre> Copyright (C) 1996-2007 Andy Wardley. All Rights Reserved.</pre>
<p>
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
</p>
[%- END %]
[% WRAPPER section
title="SEE ALSO"
-%]<p>
[% ttlink('Template::Plugin', 'Template::Plugin') -%]
</p>
[%- END %]