Skip to content

macros or block with parameters #5

Description

Hi,

Very good template language, but I miss macros or block with parameters.
What I mean by this:

--- my_template.html
<html>
<some><code>
  {* blocks.my_macro(a1, table) *}
</html>

{- my_macro(arg1, arg2) -}
    <div>
      {% if arg1 the %}
           <some>arg2.param1<code>
      {% end %}
    </div>
{-my_macro-}

I tried to call the function lua by {* *} and define the another rendering in lua code, but it does not work properly. eg:

--- my_template.html
<html>
<some><code>
  {* my_macro(a1, table) *}
</html>

my_macro passed in the context as:

template.compile(macro_code)(macro_args)

It seems that the function call template.compile recursively OpenResty is not well tested and does not work properly.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions