const mixinafEfan::EfanRenderer

afEfan::EfanRenderer

As implemented by all generated efan types returned from EfancCompiler.

ctxType

Source

abstract Type? ctxType

The ctx type the renderer was generated for.

render

Source

virtual Str render(Obj? ctx)

The main render method.

Renders the efan template to a Str, passing in the given ctx (which must fit ctxType).

renderBody

Source

virtual Void renderBody()

Renders the body of the enclosing efan template. Example, a layout.html may be defined as:

<html>
<head>
  <title><%= ctx.pageTitle %>
</html>
<body>
    <div class="wotever">
      <% renderBody() %>
    </div>
</html>
renderEfan

Source

virtual Void renderEfan(EfanRenderer renderer, Obj? rendererCtx := null, |EfanRenderer? bodyFunc := null)

Renders the given nested efan template. Use when you want to enclose content in an outer efan template. The content will be rendered whenever the renderer calls renderBody(). Example:

...
<% renderEfan(ctx.layout, ctx.layoutCtx) { %>
  ... my main content ...
<% } %>
...