~mna/tulip

The tulip.pkg.template module exports the template package. It uses the lua-resty-template module.

#Configuration

  • root_path: string = path to the root directory of templates

#API Extensions

Registering this package provides the following method and field extensions.

#s, err = App:render(path, ctx)

Renders a template using the provided context.

Args:

  • path: string = the path to the view, if a root_path was configured, this is relative to that path.
  • ctx: table = the context to execute the template. If the app.locals field exist, it is added as ctx.locals, with any existing ctx.locals values overriding the app's.

Returns:

  • s: string = the rendered template
  • err: Error|nil = the error message if s is falsy

Back to index

About this wiki

commit 3ebfbd288b8e5c95fdf8ce2027a0e94cfa1c8976
Author: Martin Angers <martin.n.angers@gmail.com>
Date:   2021-02-25T14:07:12-05:00

Update to reflect Request:validate_body
Clone this wiki
https://git.sr.ht/~mna/tulip-wiki (read-only)
git@git.sr.ht:~mna/tulip-wiki (read/write)