Namespace mmir.parser.RenderUtils
RenderUtils
Defined in: templateRenderUtils.js.
Constructor Attributes | Constructor Name and Description |
---|---|
A Utility class for rendering parsed (eHTML) templates, or more specifically ParsingResult objects.
|
Method Attributes | Method Name and Description |
---|---|
renderContentElement(htmlContentString, data, renderingBuffer)
Renders a single ContentElement object.
|
|
renderJS(rawJSSourceCode, replacementObjectsList, isForcePrefix)
Prepares JavaScript source code for usage in rendering the template (view/partial etc.
|
|
renderLayout(parseResult, contentForArray)
Renders a layout in preparation for displaying content:
This function should be used to preperare the layout content, so that its
views can be rendered into it (needs to be done only once, after the layout is loaded).
|
|
renderViewContent(htmlContentString, YieldDeclaration[]}, contentForObjectsArray, data)
Renders a view.
|
|
renderViewDialogs(htmlContentString, YieldDeclaration[]}, contentForObjectsArray, data)
Renders the dialog content for a view.
|
Namespace Detail
mmir.parser.RenderUtils
A Utility class for rendering parsed (eHTML) templates, or more specifically ParsingResult objects.
mmir.parser.RenderUtils.render(parseResult, contentElementList);
Method Detail
getInstance()
- Deprecated:
- instead, use RenderUtils object directly (i.e. omit getInstance() call)
{String}
renderContentElement(htmlContentString, data, renderingBuffer)
Renders a single ContentElement object.
During rendering, the view's template-expressions are evaluated, and the results rendered into the returned String.
- Parameters:
- {String} htmlContentString
- the original view-template text
- {Object} data Optional
- a JSON object which's fields will be available during rendering/evaluation of the template expressions
- {String[]} renderingBuffer Optional
- if provided, the partial rendering results will be appended to this Array
- Returns:
- {String} the evalutated and rendered ContentElement; if renderingBuffer was provided and not empty, the result will be prepended with the concatenated contents of the Array's Strings
renderJS(rawJSSourceCode, replacementObjectsList, isForcePrefix)
Prepares JavaScript source code for usage in rendering the template (view/partial etc.).
The replacement-list contains information which parts of the raw JavaScript code should be
modified (e.g. indices [start,end] for replacing text in the source code).
The function returns the modified JavaScript source code as a String.
If the mode is
isForcePrefix == true
, the variable-names that correspond
to replacementObjectsList are check: if a name does not start with @, then the name will prepended with @ before
rendering.
- Parameters:
- {String} rawJSSourceCode
- the original JavaScript source code
- {mmir.parser.ParsingResult[]} replacementObjectsList
- {Boolean} isForcePrefix Optional
{String}
renderLayout(parseResult, contentForArray)
Renders a layout in preparation for displaying content:
This function should be used to preperare the layout content, so that its
views can be rendered into it (needs to be done only once, after the layout is loaded).
- Parameters:
- {mmir.parser.ParsingResult} parseResult
- the parsed view template
- {ContentElement[]} contentForArray Optional
- Returns:
- {String} the prepared layout content
{String}
renderViewContent(htmlContentString, YieldDeclaration[]}, contentForObjectsArray, data)
Renders a view.
During rendering, the view's template-expressions are evaluated, and the results rendered into the returned String.
- Parameters:
- {String} htmlContentString
- the original view-content of the layout-template text, see Layout#getBodyContents
- YieldDeclaration[]}
- yieldDeclarationsArray a list of yield-declarations of the layout
- {ContentElement[]} contentForObjectsArray
- a list of content-for objects of the view. This list must supply a corresponding objecet for each entry in the yieldDeclarationsArray.
- {Object} data Optional
- a JSON object which's fields will be available during rendering/evaluation of the template expressions
- Returns:
- {String} the evalutated and rendered view-content
{String}
renderViewDialogs(htmlContentString, YieldDeclaration[]}, contentForObjectsArray, data)
Renders the dialog content for a view.
During rendering, the view's template-expressions are evaluated, and the results rendered into the returned String.
- Parameters:
- {String} htmlContentString
- the original dialog-content of the layout-template text, see Layout#getDialogsContents
- YieldDeclaration[]}
- yieldDeclarationsArray a list of yield-declarations of the layout
- {ContentElement[]} contentForObjectsArray
- a list of content-for objects of the view. This list must supply a corresponding objecet for each entry in the yieldDeclarationsArray.
- {Object} data Optional
- a JSON object which's fields will be available during rendering/evaluation of the template expressions
- Returns:
- {String} the evalutated and rendered dialog-content