Class RawHandlebarsHelper

  • All Implemented Interfaces:
    com.github.jknack.handlebars.Helper<Object>

    @Component
    public class RawHandlebarsHelper
    extends BaseHelper
    The {{#raw}} handlebars helper allows for the contents of the block to be output as-is, without any further processing.

    Usage

    The {{#raw}} handlebars helper allows for the contents of the block to be output as-is, without any further processing.

    This can be particularly useful when the block may contain handlebars expressions, but the developer wants them to be output as-is within the published page.

    Example

      {{#raw}}
       <p>The handlebars expression for the canonical URL of a page is {{canonicalURL}}.</p>
      {{/raw}}
     

    In the above example, the contents of the raw block will be published directly within the page, without the {{canonicalURL}} handlebars expression being evaluated.

    • Constructor Detail

      • RawHandlebarsHelper

        public RawHandlebarsHelper()
    • Method Detail

      • apply

        public String apply​(Object context,
                            com.github.jknack.handlebars.Options options)
        Description copied from class: BaseHelper
        The apply method is the main entry point for handlebars.java helpers.

        It is called internally by the handlebars.java engine when a matching handlebars.java expression is encountered.

        Specified by:
        apply in interface com.github.jknack.handlebars.Helper<Object>
        Specified by:
        apply in class BaseHelper
        Parameters:
        context - The currently executing context.
        options - The options.
        Returns:
        The generated output.