Class Nl2brHandlebarsHelper

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

    @Component
    public class Nl2brHandlebarsHelper
    extends BaseHelper
    The {{nlbr ...}} handlebars helper is used to replace new lines with <br /> tags in the current evaluation context.

    Usage

    The {{nlbr ...}} handlebars helper is used to replace new lines with <br /> tags in the current evaluation context.

    This will generally be used in conjunction with text, such as that from Plain Text Content Elements.

    Example

      {{nl2br (publish element="Plain Text")}}
     

    In the above example, new line characters will be replaced in the text that is returned from the publish helper.

    • Constructor Detail

      • Nl2brHandlebarsHelper

        public Nl2brHandlebarsHelper()
    • 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.