[%# # 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; INCLUDE tocitem title="SYNOPSIS"; INCLUDE tocitem title="DESCRIPTION"; INCLUDE tocitem title="METHODS" subs=["escape(text)", "attributes(hash)", "element(type, attributes)"]; INCLUDE tocitem title="AUTHOR"; INCLUDE tocitem title="VERSION"; INCLUDE tocitem title="COPYRIGHT"; INCLUDE tocitem title="SEE ALSO"; END %] [% WRAPPER section title="SYNOPSIS" -%]
    [% tt_start_tag %] USE HTML [% tt_end_tag %]
    [% tt_start_tag %] HTML.escape("if (a < b && c > d) ..." [% tt_end_tag %]
    [% tt_start_tag %] HTML.element(table => { border => 1, cellpadding => 2 }) [% tt_end_tag %]
    [% tt_start_tag %] HTML.attributes(border => 1, cellpadding => 2) [% tt_end_tag %]
[%- END %] [% WRAPPER section title="DESCRIPTION" -%]

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).

[%- END %] [% WRAPPER section title="METHODS" -%][% WRAPPER subsection title = "escape(text)" -%]

Returns the source text with any HTML reserved characters such as <, >, etc., correctly esacped to their entity equivalents.

[%- END %] [% WRAPPER subsection title = "attributes(hash)" -%]

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.

[%- END %] [% WRAPPER subsection title = "element(type, attributes)" -%]

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.

    [% 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 %]
[%- END %] [%- END %] [% WRAPPER section title="AUTHOR" -%]

Andy Wardley <abw@kfs.org>

[% ttlink('http://www.andywardley.com/', 'http://www.andywardley.com/') -%]

[%- END %] [% WRAPPER section title="VERSION" -%]

2.02, distributed as part of the Template Toolkit version 2.03, released on 15 June 2001.

[%- END %] [% WRAPPER section title="COPYRIGHT" -%]
  Copyright (C) 1996-2001 Andy Wardley.  All Rights Reserved.
  Copyright (C) 1998-2001 Canon Research Centre Europe Ltd.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

[%- END %] [% WRAPPER section title="SEE ALSO" -%]

[% ttlink('Template::Plugin', 'Template::Plugin') -%]

[%- END %]