[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/amd/src/ -> mustache.js (summary)

(no description)

File Size: 734 lines (23 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 16 functions

  isFunction()
  typeStr()
  escapeRegExp()
  hasProperty()
  testRegExp()
  isWhitespace()
  escapeHtml()
  parseTemplate()
  stripSpace()
  compileTags()
  squashTokens()
  nestTokens()
  Scanner()
  Context()
  Writer()
  subRender()

Functions
Functions that are not part of a class:

isFunction(object)   X-Ref
No description

typeStr(obj)   X-Ref
More correct typeof string handling array
which normally returns typeof 'object'


escapeRegExp(string)   X-Ref
No description

hasProperty(obj, propName)   X-Ref
Null safe way of checking whether or not an object,
including its prototype, has a given property


testRegExp(re, string)   X-Ref
No description

isWhitespace(string)   X-Ref
No description

escapeHtml(string)   X-Ref
No description

parseTemplate(template, tags)   X-Ref
Breaks up the given `template` string into a tree of tokens. If the `tags`
argument is given here it must be an array with two string values: the
opening and closing tags used in the template (e.g. [ "<%", "%>" ]). Of
course, the default is to use mustaches (i.e. mustache.tags).

A token is an array with at least 4 elements. The first element is the
mustache symbol that was used inside the tag, e.g. "#" or "&". If the tag
did not contain a symbol (i.e. {{myValue}}) this element is "name". For
all text that appears outside a symbol this element is "text".

The second element of a token is its "value". For mustache tags this is
whatever else was inside the tag besides the opening symbol. For text tokens
this is the text itself.

The third and fourth elements of the token are the start and end indices,
respectively, of the token in the original template.

Tokens that are the root node of a subtree contain two more elements: 1) an
array of tokens in the subtree and 2) the index in the original template at
which the closing tag for that section begins.

stripSpace()   X-Ref
No description

compileTags(tagsToCompile)   X-Ref
No description

squashTokens(tokens)   X-Ref
Combines the values of consecutive text tokens in the given `tokens` array
to a single token.


nestTokens(tokens)   X-Ref
Forms the given array of `tokens` into a nested tree structure where
tokens that represent a section have two additional items: 1) an array of
all tokens that appear in that section and 2) the index in the original
template that represents the end of that section.


Scanner(string)   X-Ref
A simple string scanner that is used by the template parser to find
tokens in template strings.


Context(view, parentContext)   X-Ref
Represents a rendering context by wrapping a view object and
maintaining a reference to the parent context.


Writer()   X-Ref
A Writer knows how to take a stream of tokens and render them to a
string, given a context. It also maintains a cache of templates to
avoid the need to parse the same template twice.


subRender(template)   X-Ref
No description



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1