[%# # 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 = 'Parser' %] [% WRAPPER toc; PROCESS tocitem title ="SYNOPSIS" subs = []; PROCESS tocitem title ="DESCRIPTION" subs = []; PROCESS tocitem title ="PUBLIC METHODS" subs = [ "new(\\%params)", "parse(\$text)" ]; PROCESS tocitem title ="AUTHOR" subs = []; PROCESS tocitem title ="VERSION" subs = []; PROCESS tocitem title ="COPYRIGHT" subs = []; PROCESS tocitem title ="SEE ALSO" subs = []; WRAPPER subsection title = "Format" -%]
The Format plugin provides a simple way to format text according to a printf()-like format. See [% ttlink('Template::Plugin::Format') -%] for further details.
[% tt_start_tag %] USE bold = format('<b>%s</b>') [% tt_end_tag %]
[% tt_start_tag %] bold('Hello') [% tt_end_tag %]
[%- END %]
[% WRAPPER subsection
title = "GD::Image, GD::Polygon, GD::Constants"
-%]These plugins provide access to the GD graphics library via Lincoln D. Stein's GD.pm interface. These plugins allow PNG, JPEG and other graphical formats to be generated.
[% tt_start_tag %] FILTER null;
USE im = GD.Image(100,100);
# allocate some colors
black = im.colorAllocate(0, 0, 0);
red = im.colorAllocate(255,0, 0);
blue = im.colorAllocate(0, 0, 255);
# Draw a blue oval
im.arc(50,50,95,75,0,360,blue);
# And fill it with red
im.fill(50,50,red);
# Output image in PNG format
im.png | stdout(1);
END;
-[% tt_end_tag %]
See [% ttlink('Template::Plugin::GD::Image') -%] for further details.
[%- END %] [% WRAPPER subsection title = "GD::Text, GD::Text::Align, GD::Text::Wrap" -%]These plugins provide access to Martien Verbruggen's GD::Text, GD::Text::Align and GD::Text::Wrap modules. These plugins allow the layout, alignment and wrapping of text when drawing text in GD images.
[% tt_start_tag %] FILTER null;
USE gd = GD.Image(200,400);
USE gdc = GD.Constants;
black = gd.colorAllocate(0, 0, 0);
green = gd.colorAllocate(0, 255, 0);
txt = "This is some long text. " | repeat(10);
USE wrapbox = GD.Text.Wrap(gd,
line_space => 4,
color => green,
text => txt,
);
wrapbox.set_font(gdc.gdMediumBoldFont);
wrapbox.set(align => 'center', width => 160);
wrapbox.draw(20, 20);
gd.png | stdout(1);
END;
-[% tt_end_tag %]
See [% ttlink('Template::Plugin::GD::Text') -%], [% ttlink('Template::Plugin::GD::Text::Align') -%] and [% ttlink('Template::Plugin::GD::Text::Wrap') -%] for further details.
[%- END %] [% WRAPPER subsection title = "GD::Graph::lines, GD::Graph::bars, GD::Graph::points, GD::Graph::linespoin ts, GD::Graph::area, GD::Graph::mixed, GD::Graph::pie" -%]These plugins provide access to Martien Verbruggen's GD::Graph module that allows graphs, plots and charts to be created. These plugins allow graphs, plots and charts to be generated in PNG, JPEG and other graphical formats.
[% tt_start_tag %] FILTER null;
data = [
["1st","2nd","3rd","4th","5th","6th"],
[ 4, 2, 3, 4, 3, 3.5]
];
USE my_graph = GD.Graph.pie(250, 200);
my_graph.set(
title => 'A Pie Chart',
label => 'Label',
axislabelclr => 'black',
pie_height => 36,
transparent => 0,
);
my_graph.plot(data).png | stdout(1);
END;
-[% tt_end_tag %]
See [% ttlink('Template::Plugin::GD::Graph::lines') -%], [% ttlink('Template::Plugin::GD::Graph::bars') -%], [% ttlink('Template::Plugin::GD::Graph::points') -%], [% ttlink('Template::Plugin::GD::Graph::linespoints') -%], [% ttlink('Template::Plugin::GD::Graph::area') -%], [% ttlink('Template::Plugin::GD::Graph::mixed') -%], [% ttlink('Template::Plugin::GD::Graph::pie') -%], and [% ttlink('GD::Graph') -%], for more details.
[%- END %] [% WRAPPER subsection title = "GD::Graph::bars3d, GD::Graph::lines3d, GD::Graph::pie3d" -%]These plugins provide access to Jeremy Wadsack's GD::Graph3d module. This allows 3D bar charts and 3D lines plots to be generated.
[% tt_start_tag %] FILTER null;
data = [
["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"],
[ 1, 2, 5, 6, 3, 1.5, 1, 3, 4],
];
USE my_graph = GD.Graph.bars3d();
my_graph.set(
x_label => 'X Label',
y_label => 'Y label',
title => 'A 3d Bar Chart',
y_max_value => 8,
y_tick_number => 8,
y_label_skip => 2,
# shadows
bar_spacing => 8,
shadow_depth => 4,
shadowclr => 'dred',
transparent => 0,
my_graph.plot(data).png | stdout(1);
END;
-[% tt_end_tag %]
See [% ttlink('Template::Plugin::GD::Graph::lines3d') -%], [% ttlink('Template::Plugin::GD::Graph::bars3d') -%], and [% ttlink('Template::Plugin::GD::Graph::pie3d') -%] for more details.
[%- END %] [% WRAPPER subsection title = "HTML" -%]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).
[% 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.attributes(border => 1, cellpadding => 2) [% tt_end_tag %]
[% tt_start_tag %] HTML.element(table => { border => 1, cellpadding => 2 }) [% tt_end_tag %]
See [% ttlink('Template::Plugin::HTML') -%] for further details.
[%- END %] [% WRAPPER subsection title = "Iterator" -%]The Iterator plugin provides a way to create a Template::Iterator object to iterate over a data set. An iterator is created automatically by the FOREACH directive and is aliased to the 'loop' variable. This plugin allows an iterator to be explicitly created with a given name, or the default plugin name, 'iterator'. See [% ttlink('Template::Plugin::Iterator') -%] for further details.
[% tt_start_tag %] USE iterator(list, args) [% tt_end_tag %]
[% tt_start_tag %] FOREACH item = iterator [% tt_end_tag %]
[% tt_start_tag %] '<ul>' IF iterator.first [% tt_end_tag %]
<li>[% tt_start_tag %] item [% tt_end_tag %]
[% tt_start_tag %] '</ul>' IF iterator.last [% tt_end_tag %]
[% tt_start_tag %] END [% tt_end_tag %]
[%- END %]
[% WRAPPER subsection
title = "Pod"
-%]This plugin provides an interface to the [% ttlink('Pod::POM', 'Pod::POM') -%] module which parses POD documents into an internal object model which can then be traversed and presented through the Template Toolkit.
[% tt_start_tag %] USE Pod(podfile) [% tt_end_tag %]
[% tt_start_tag %] FOREACH head1 = Pod.head1;
FOREACH head2 = head1/head2;
...
END;
END
[% tt_end_tag %]
[%- END %]
[% WRAPPER subsection
title = "String"
-%]The String plugin implements an object-oriented interface for manipulating strings. See [% ttlink('Template::Plugin::String') -%] for further details.
[% tt_start_tag %] USE String 'Hello' [% tt_end_tag %]
[% tt_start_tag %] String.append(' World') [% tt_end_tag %]
[% tt_start_tag %] msg = String.new('Another string') [% tt_end_tag %]
[% tt_start_tag %] msg.replace('string', 'text') [% tt_end_tag %]
The string "[% tt_start_tag %] msg [% tt_end_tag %]" is [% tt_start_tag %] msg.length [% tt_end_tag %] characters long.[%- END %] [% WRAPPER subsection title = "Table" -%]
The Table plugin allows you to format a list of data items into a virtual table by specifying a fixed number of rows or columns, with an optional overlap. See [% ttlink('Template::Plugin::Table') -%] for further details.
[% tt_start_tag %] USE table(list, rows=10, overlap=1) [% tt_end_tag %]
[% tt_start_tag %] FOREACH item = table.col(3) [% tt_end_tag %]
[% tt_start_tag %] item [% tt_end_tag %]
[% tt_start_tag %] END [% tt_end_tag %]
[%- END %]
[% WRAPPER subsection
title = "URL"
-%]The URL plugin provides a simple way of contructing URLs from a base part and a variable set of parameters. See [% ttlink('Template::Plugin::URL') -%] for further details.
[% tt_start_tag %] USE mycgi = url('/cgi-bin/bar.pl', debug=1) [% tt_end_tag %]
[% tt_start_tag %] mycgi [% tt_end_tag %]
# ==> /cgi/bin/bar.pl?debug=1
[% tt_start_tag %] mycgi(mode='submit') [% tt_end_tag %]
# ==> /cgi/bin/bar.pl?mode=submit&debug=1
[%- END %]
[% WRAPPER subsection
title = "Wrap"
-%]The Wrap plugin uses the Text::Wrap module by David Muir Sharnoff <muir@idiom.com> (with help from Tim Pierce and many many others) to provide simple paragraph formatting. See [% ttlink('Template::Plugin::Wrap') -%] and [% ttlink('Text::Wrap') -%] for further details.
[% tt_start_tag %] USE wrap [% tt_end_tag %]
[% tt_start_tag %] wrap(mytext, 40, '* ', ' ') [% tt_end_tag %] # use wrap sub
[% tt_start_tag %] mytext FILTER wrap(40) -[% tt_end_tag %] # or wrap FILTER
The Text::Wrap module is available from CPAN:
http://www.cpan.org/modules/by-module/Text/[%- END %] [% WRAPPER subsection title = "XML::DOM" -%]
The XML::DOM plugin gives access to the XML Document Object Module via Clark Cooper <cooper@sch.ge.com> and Enno Derksen's <enno@att.com> XML::DOM module. See [% ttlink('Template::Plugin::XML::DOM') -%] and [% ttlink('XML::DOM') -%] for further details.
[% tt_start_tag %] USE dom = XML.DOM [% tt_end_tag %]
[% tt_start_tag %] doc = dom.parse(filename) [% tt_end_tag %]
[% tt_start_tag %] FOREACH node = doc.getElementsByTagName('CODEBASE') [% tt_end_tag %]
* [% tt_start_tag %] node.getAttribute('href') [% tt_end_tag %]
[% tt_start_tag %] END [% tt_end_tag %]
The plugin requires the XML::DOM module, available from CPAN:
http://www.cpan.org/modules/by-module/XML/[%- END %] [% WRAPPER subsection title = "XML::RSS" -%]
The XML::RSS plugin is a simple interface to Jonathan Eisenzopf's <eisen@pobox.com> XML::RSS module. A RSS (Rich Site Summary) file is typically used to store short news 'headlines' describing different links within a site. This plugin allows you to parse RSS files and format the contents accordingly using templates. See [% ttlink('Template::Plugin::XML::RSS') -%] and [% ttlink('XML::RSS') -%] for further details.
[% tt_start_tag %] USE news = XML.RSS(filename) [% tt_end_tag %]
[% tt_start_tag %] FOREACH item = news.items [% tt_end_tag %]
<a href="[% tt_start_tag %] item.link [% tt_end_tag %]">[% tt_start_tag %] item.title [% tt_end_tag %]</a>
[% tt_start_tag %] END [% tt_end_tag %]
The XML::RSS module is available from CPAN:
http://www.cpan.org/modules/by-module/XML/[%- END %] [% WRAPPER subsection title = "XML::Simple" -%]
This plugin implements an interface to the [% ttlink('XML::Simple', 'XML::Simple') -%] module.
[% tt_start_tag %] USE xml = XML.Simple(xml_file_or_text) [% tt_end_tag %]
[% tt_start_tag %] xml.head.title [% tt_end_tag %]
See [% ttlink('Template::Plugin::XML::Simple') -%] for further details.
[%- END %] [% WRAPPER subsection title = "XML::Style" -%]This plugin defines a filter for performing simple stylesheet based transformations of XML text.
[% tt_start_tag %] USE xmlstyle
table = {
attributes = {
border = 0
cellpadding = 4
cellspacing = 1
}
}
[% tt_end_tag %]
[% tt_start_tag %] FILTER xmlstyle [% tt_end_tag %]
<table>
<tr>
<td>Foo</td> <td>Bar</td> <td>Baz</td>
</tr>
</table>
[% tt_start_tag %] END [% tt_end_tag %]
See [% ttlink('Template::Plugin::XML::Style') -%] for further details.
[%- END %] [% WRAPPER subsection title = "XML::XPath" -%]The XML::XPath plugin provides an interface to Matt Sergeant's <matt@sergeant.org> XML::XPath module. See [% ttlink('Template::Plugin::XML::XPath') -%] and [% ttlink('XML::XPath') -%] for further details.
[% tt_start_tag %] USE xpath = XML.XPath(xmlfile) [% tt_end_tag %]
[% tt_start_tag %] FOREACH page = xpath.findnodes('/html/body/page') [% tt_end_tag %]
[% tt_start_tag %] page.getAttribute('title') [% tt_end_tag %]
[% tt_start_tag %] END [% tt_end_tag %]
The plugin requires the XML::XPath module, available from CPAN:
http://www.cpan.org/modules/by-module/XML/[%- END %] [%- END %] [% WRAPPER section title="BUGS / ISSUES" -%]
It might be worthwhile being able to distinguish between absolute module names and those which should be applied relative to PLUGIN_BASE directories. For example, use 'MyNamespace::MyModule' to denote absolute module names (e.g. LOAD_PERL), and 'MyNamespace.MyModule' to denote relative to PLUGIN_BASE.
Andy Wardley <abw@andywardley.com>
[% ttlink('http://www.andywardley.com/', 'http://www.andywardley.com/') -%]
[%- END %] [% WRAPPER section title="VERSION" -%]2.71, distributed as part of the Template Toolkit version 2.14, released on 04 October 2004.
[%- END %] [% WRAPPER section title="COPYRIGHT" -%]Copyright (C) 1996-2004 Andy Wardley. All Rights Reserved. Copyright (C) 1998-2002 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', 'Template') -%], [% ttlink('Template::Plugin', 'Template::Plugin') -%], [% ttlink('Template::Context', 'Template::Context') -%]
[%- END %] ./usr/share/doc/libtemplate-perl-doc/src/Modules/Template/Parser.html 0000644 0000000 0000000 00000045165 10130222612 025732 0 ustar root root 0000000 0000000 [%# # 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 = 'Parser' %] [% WRAPPER toc; PROCESS tocitem title ="SYNOPSIS" subs = []; PROCESS tocitem title ="DESCRIPTION" subs = []; PROCESS tocitem title ="PUBLIC METHODS" subs = [ "new(\\%params)", "parse(\$text)" ]; PROCESS tocitem title ="AUTHOR" subs = []; PROCESS tocitem title ="VERSION" subs = []; PROCESS tocitem title ="COPYRIGHT" subs = []; PROCESS tocitem title ="SEE ALSO" subs = []; WRAPPER subsection title = "Format" -%]The Format plugin provides a simple way to format text according to a printf()-like format. See [% ttlink('Template::Plugin::Format') -%] for further details.
[% tt_start_tag %] USE bold = format('<b>%s</b>') [% tt_end_tag %]
[% tt_start_tag %] bold('Hello') [% tt_end_tag %]
[%- END %]
[% WRAPPER subsection
title = "GD::Image, GD::Polygon, GD::Constants"
-%]These plugins provide access to the GD graphics library via Lincoln D. Stein's GD.pm interface. These plugins allow PNG, JPEG and other graphical formats to be generated.
[% tt_start_tag %] FILTER null;
USE im = GD.Image(100,100);
# allocate some colors
black = im.colorAllocate(0, 0, 0);
red = im.colorAllocate(255,0, 0);
blue = im.colorAllocate(0, 0, 255);
# Draw a blue oval
im.arc(50,50,95,75,0,360,blue);
# And fill it with red
im.fill(50,50,red);
# Output image in PNG format
im.png | stdout(1);
END;
-[% tt_end_tag %]
See [% ttlink('Template::Plugin::GD::Image') -%] for further details.
[%- END %] [% WRAPPER subsection title = "GD::Text, GD::Text::Align, GD::Text::Wrap" -%]These plugins provide access to Martien Verbruggen's GD::Text, GD::Text::Align and GD::Text::Wrap modules. These plugins allow the layout, alignment and wrapping of text when drawing text in GD images.
[% tt_start_tag %] FILTER null;
USE gd = GD.Image(200,400);
USE gdc = GD.Constants;