Lemplate

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

* bugfix: added version numbers to Lemplate::Parser and Lemplate::Directive.

0.08 2017-05-06
* feature: added more vmethods to Lemplate.
    * rewrote stash_get and implemented methods push, keys, split and join.
    * added a sort vmethod.
    * updated lempate script with new vmethod features.

* feature: support custom lua TT filters. Example:

    lemplate = require('my.templates')
    lemplate.filters['upper'] = function(str, args)
        return string.upper(str)
    end
    lemplate.process('[% "i like pie" | upper %]')

* feature: added 2 more standard filters: upper and lower.

0.07 2016-07-15
* added MANIFEST.SKIP to exclude unwanted files from packaging.

README.md  view on Meta::CPAN

This is still under early development. Check back often.

# Synopsis

From the command-line:

    lemplate --compile path/to/lemplate/directory/ > myapp/templates.lua

From OpenResty Lua code:

    local templates = require "myapp.templates"
    ngx.print(templates.process("homepage.tt2", { var1 = 32, var2 = "foo" }))

From the command-line:

    lemplate --compile path/to/lemplate/directory/ > myapp/templates.lua

# Description

Lemplate is a templating framework for OpenResty/Lua that is built over
Perl's Template Toolkit (TT2).

README.md  view on Meta::CPAN


You might run this command:

    $ lemplate --compile template/* > myapp/templates.lua

This will compile all the templates into one Lua module file which can be loaded in your
main OpenResty/Lua application as the module `myapp.templates`.

Now all you need to do is load the Lua module file in your OpenResty app:

    local templates = require "myapp.templates"

and do the HTML page rendering:

    local results = templates.process("some-page.tt2",
                                      { var1 = val1, var2 = val2, ...})

Now you have Lemplate support for these templates in your OpenResty application.

[Back to TOC](#table-of-contents)

lemplate  view on Meta::CPAN

}

sub _load_compiled {
    my ($self, $file) = @_;
    my $compiled;

    # load compiled template via require();  we zap any
    # %INC entry to ensure it is reloaded (we don't
    # want 1 returned by require() to say it's in memory)
    delete $INC{ $file };
    eval { $compiled = require $file; };
    return $@
        ? $self->error("compiled template $compiled: $@")
        : $compiled;
}


sub _load {
    my ($self, $name, $alias) = @_;
    my ($data, $error);
    my $tolerant = $self->{ TOLERANT };

lib/Lemplate.pm  view on Meta::CPAN

This is still under early development. Check back often.

=head1 Synopsis

From the command-line:

    lemplate --compile path/to/lemplate/directory/ > myapp/templates.lua

From OpenResty Lua code:

    local templates = require "myapp.templates"
    ngx.print(templates.process("homepage.tt2", { var1 = 32, var2 = "foo" }))

From the command-line:

    lemplate --compile path/to/lemplate/directory/ > myapp/templates.lua

=head1 Description

Lemplate is a templating framework for OpenResty/Lua that is built over
Perl's Template Toolkit (TT2).

lib/Lemplate.pm  view on Meta::CPAN


You might run this command:

    $ lemplate --compile template/* > myapp/templates.lua

This will compile all the templates into one Lua module file which can be loaded in your
main OpenResty/Lua application as the module C<myapp.templates>.

Now all you need to do is load the Lua module file in your OpenResty app:

    local templates = require "myapp.templates"

and do the HTML page rendering:

    local results = templates.process("some-page.tt2",
                                      { var1 = val1, var2 = val2, ...})

Now you have Lemplate support for these templates in your OpenResty application.

=head1 Public API



( run in 0.578 second using v1.01-cache-2.11-cpan-0d8aa00de5b )