mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
feature(rendy) v1.1.0
This commit is contained in:
parent
ca824c07eb
commit
f63a14aa18
2 changed files with 9 additions and 8 deletions
15
lib/util.js
15
lib/util.js
|
|
@ -206,18 +206,19 @@
|
|||
* function render template with view and own symbols
|
||||
*
|
||||
* @param templ
|
||||
* @param view
|
||||
* @param data
|
||||
*/
|
||||
this.render = function(templ, view) {
|
||||
var result = templ;
|
||||
this.render = function(templ, data) {
|
||||
var result = templ;
|
||||
|
||||
Object
|
||||
.keys(view)
|
||||
.keys(data)
|
||||
.forEach(function(param) {
|
||||
var str = view[param],
|
||||
regExp = RegExp('{{\\s' + param + '\\s}}', 'g');
|
||||
var name = '{{ ' + param + ' }}',
|
||||
str = data[param];
|
||||
|
||||
result = result.replace(regExp, str);
|
||||
while(~result.indexOf(name))
|
||||
result = result.replace(name, str);
|
||||
});
|
||||
|
||||
if (~result.indexOf('{{'))
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
"mollify": "~1.0.0",
|
||||
"pipe-io": "~1.1.1",
|
||||
"ponse": "~1.3.0",
|
||||
"rendy": "~1.0.2",
|
||||
"rendy": "~1.1.0",
|
||||
"restafary": "~1.3.0",
|
||||
"socket.io": "~1.3.5",
|
||||
"try-catch": "~1.0.0",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue