rife.render.EncodeJs - rife2/rife2-template-renderers GitHub Wiki
Encodes a template value to JavaScript/ECMAScript.
Usage
<!--v render:rife.render.EncodeJs:valueId/-->
{{v render:rife.render.EncodeJs:valueId/}}
Sample
Template
alert("{{v render:rife.reader.EncodeJs:alert/}}");
Code
template.setAttribute("alert", "It's alright! Everything is /OK/!");
Output
alert("It\'s alright! Everything is \/OK\/!");
Properties
By default, the rendered data is raw, not template encoded. If you need additional encoding, use the encoding
property.
For example, to encode the rendered data to HTML:
{{v render:rife.render.EncodeJs:valueId}}
encoding=html
{{/v}}
The supported additional encoding types are:
html
js
json
unicode
url
xml