Class TemplateToken

Version
0.1
Defined in
Template.js

Token objects used by Template to apply and display data granularly.

Class Summary
Constructor Attributes Constructor Name and Description
 
Individual token objects used by Template objects to render their appropriate content.
Method Summary
Method Attributes Method Name and Description
 
Gets the value of the token, taking into account any default values that have been defined.
 
Returns a boolean true|false representing whether or not there is a returnable value.
 
replaceIn(txt)
Replaces the current value for any occurrences of the raw token string in the provided txt
 
setValue(val)
Sets the value of this token to the provided val, taking into account any modifiers in its calculation.
Class Detail
TemplateToken(opts)
Individual token objects used by Template objects to render their appropriate content. TemplateToken syntax is expected as: ${{<title>|<mod_name>="<mod_value>"}} where:
title: The title of the current token (used to assign values)
mod_name: Name of the modifier(s). Valid modifiers are covered in TemplateToken#parseToken.
mod_value: Value of the current modifier (ie, type="text")

Author: Garth Henson (Guahan Web).
Parameters:
{Object} opts
Options used to configure the template
Method Detail
{varied} getValue()
Gets the value of the token, taking into account any default values that have been defined.
Returns:
{varied} The current value
{boolean} hasValue()
Returns a boolean true|false representing whether or not there is a returnable value.
Returns:
{boolean} Whether or not there is a value assigned
{string} replaceIn(txt)
Replaces the current value for any occurrences of the raw token string in the provided txt
Parameters:
{string} txt
The text on which to run the replacement
Returns:
{string} The modified text string
setValue(val)
Sets the value of this token to the provided val, taking into account any modifiers in its calculation.
Parameters:
{varied} val
The value to be assigned