Package rife.render

Class Abbreviate

java.lang.Object
rife.render.Abbreviate
All Implemented Interfaces:
ValueRenderer

public class Abbreviate extends Object implements ValueRenderer

Abbreviates a template value with ellipses.

Usage:

   <!--v render:rife.render.Abbreviate:valueId/-->
   {{v render:rife.render.Abbreviate:valueId/}}
 
Since:
1.0
Author:
Erik C. Thauvin
See Also:
  • Constructor Details

    • Abbreviate

      public Abbreviate()
  • Method Details

    • render

      public String render(Template template, String valueId, String differentiator)

      Returns the template value abbreviated with ellipses.

      Two parameters can be specified:

      • mark: the string that will be used to abbreviate the value. Default is ...
      • max: the maximum number of characters to render. Default is -1 (no abbreviation).
      Specified by:
      render in interface ValueRenderer
      Parameters:
      template - the template that contains the value
      valueId - the id of the value to render
      differentiator - a generic string that can be used to differentiate the rendering
      Returns:
      the abbreviated value, or the original value if no abbreviation is necessary