Andriy Drozdyuk
Andriy Drozdyuk

Reputation: 61061

How to create an erlydtl custom tag?

The docs say:

"Starting with release 0.9.1, the recommended way to add custom tags and filters are to register a module"

How does one register a module with erlydtl?

Upvotes: 0

Views: 142

Answers (1)

Kaos
Kaos

Reputation: 1004

From my answer at https://github.com/erlydtl/erlydtl/issues/238

It's the options that refers to library you want (from the Readme):

libraries - A list of {Name, Module} libraries implementing custom tags and filters. Module should implement the erlydtl_library behaviour.

And:

default_libraries - A list of libraries that should be loaded by default when compiling a template. Libraries can be specified either by name (when there is a name to module mapping also provided in the libraries option) or by module.

If you register a library, but doesn't load it by default, you can load it from a template with the {% load libname %} tag.

Upvotes: 1

Related Questions