Name : perl-Text-Handlebars
| |
Version : 0.05
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : 1.57
| Date : 2024-08-05 20:44:09
|
Group : Development/Libraries/Perl
| Source RPM : perl-Text-Handlebars-0.05-1.57.src.rpm
|
Size : 0.04 MB
| |
Packager : (none)
| |
Summary : Http://handlebarsjs.com/ for Text::Xslate
|
Description :
This module subclasses Text::Xslate to provide a parser for at http://handlebarsjs.com/ templates. In most ways, this module functions identically to Text::Xslate, except that it parses Handlebars templates instead.
Text::Handlebars accepts an additional constructor parameter of \'helpers\' to define Handlebars-style helper functions. Standard helpers are identical to functions defined with the \'function\' parameter, except that they receive the current context implicitly as the first parameter (since perl doesn\'t have an implicit \'this\' parameter). Block helpers also receive the context as the first parameter, and they also receive the \'options\' parameter as a hashref. As an example:
sub { my ($context, $items, $options) = AATT_;
my $out = \"< ul>\";
for my $item (AATT$items) { $out .= \"< li>\" . $options->{fn}->($item) . \"< /li>\"; }
return $out . \"< /ul>\ \"; },
defines a simple block helper to generate a \'< ul>\' list.
Text::Handlebars also overrides \'render\' and \'render_string\' to allow using any type of data (not just hashrefs) as a context (so rendering a template consisting of only \'{{.}}\' works properly).
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-T/openSUSE_Tumbleweed/noarch |