Member Junction
    Preparing search index...

    Extension that enables recursive template embedding using {% template "TemplateName" %} syntax.

    Features:

    • Recursive template inclusion with cycle detection
    • Content type inheritance with intelligent fallbacks
    • Data context passing and merging
    • Error handling for missing templates

    Usage: {% template "TemplateName" %} {% template "TemplateName", type="HTML" %} {% template "TemplateName", data={extra: "value"} %} {% template "TemplateName", type="PlainText", data={key: "value"} %}

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    Tags: string[] = []

    One or more tags that represent case-sensitive tag names that will invoke this extension.

    Accessors

    • get ContextUser(): UserInfo

      The user this extension acts for: the user of the render in progress. An extension instance is shared by every render in the process, so it must read this at run time and never cache it. Inside a render that has no user it is undefined; it never falls back to the user the instance was constructed with, which is whichever caller first configured the engine. Outside a render it returns the constructed user.

      Returns UserInfo

    Methods

    • Executes the template embedding logic with recursive template inclusion.

      Parameter Mapping from CallExtensionAsync:

      • In parse(): new nodes.CallExtensionAsync(this, 'run', params)
      • Results in: run(context, body, callBack)

      The body parameter will be undefined since TemplateEmbed is a self-closing tag that doesn't parse body content. The template name and configuration come from the parsed parameters instead.

      Parameters

      • context: any

        Nunjucks template rendering context containing variables and data

      • body: any

        Will be undefined for self-closing template tags (not used)

      • callBack: NunjucksCallback

        Async callback function to return results or errors

      Returns void

      {% template "HeaderTemplate" %}
      {% template "UserCard", type="HTML" %}
      {% template "Footer", data={year: 2024} %}