Member Junction
    Preparing search index...

    Class TemplateExtensionBaseAbstract

    Used for extending the functionality of the template engine (Nunjucks). Sub-class this class to create a new template extension.

    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

    • Required, must implement this method to run the extension.

      IMPORTANT: The actual signature of this method depends on what you pass to nodes.CallExtensionAsync() in your parse() method. The parameters listed here are just placeholders - your actual implementation will have different parameters.

      Common Patterns:

      • CallExtensionAsync(this, 'run', params) → run(context, body, callBack)
      • CallExtensionAsync(this, 'run', params, [body]) → run(context, params, body, callBack)
      • CallExtensionAsync(this, 'run', params, [body, error]) → run(context, params, body, error, callBack)

      Parameters

      • context: any

        Always the first parameter: Nunjucks rendering context

      • ...args: any[]

      Returns any

      README.md in this directory for detailed documentation on parameter mapping