tulip-wiki/pkg.template.md -rw-r--r-- 782 bytes
3ebfbd28Martin Angers Update to reflect Request:validate_body 1 year, 11 months ago

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


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


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


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

Back to index