Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ Grunt используется для валидации JS (тестов) и з
Если необходимо пересобрать шаблоны spec/expected, то выполните:

```
$ ./bin/fest-build --dir=spec/templates --exclude=*error* --compile.beautify=true --out=spec/expected/initial
$ ./bin/fest-build --dir=spec/templates --exclude=*error* --compile.beautify=true --out=spec/expected/translated --translate=spec/templates/en_US.po
grunt
rm -rf spec/expected/initial/ spec/expected/translate
cp -Rf spec/tmp/* spec/expected/
```
14 changes: 8 additions & 6 deletions lib/compile_tmpl.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
function compile_tmpl(file, source, wrapper) {
var fest = "var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['##file##']=##source##;";

var wrappers = {
fest: ";(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['##file##']=##source##})();",
loader: ";(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['##file##']=##source##; if(x.jsLoader!==undefined&&x.jsLoader.loaded!==undefined&&typeof x.jsLoader.loaded==='function'){x.jsLoader.loaded('{festTemplate}##file##')};})();",
source: "##source##",
amd: "define(function(){return ##source##});",
fest: ";(function(){" + fest + "})();",
loader: ";(function(){" + fest + "if(x.jsLoader!==undefined&&x.jsLoader.loaded!==undefined&&typeof x.jsLoader.loaded==='function'){x.jsLoader.loaded('{festTemplate}##file##')};})();",
source: "##source##",
amd: "define(function(){return##source##});",
variable: "var ##file##=##source##;"
};

Expand All @@ -12,10 +14,10 @@ function compile_tmpl(file, source, wrapper) {
file = file.replace(/.*\//g, '');
}

file = file.replace(/\'/g, "\\'").replace(/\"/g, '\\"').replace(/\\/g, '\\');
file = file.replace(/['"\\]/g, '\\$&');
return wrappers[wrapper || 'fest'].replace(/##file##/g, file).replace(/##source##/g, source);
}

if (typeof module !== 'undefined' && module.exports){
if (typeof module !== 'undefined' && module.exports) {
module.exports = compile_tmpl;
}
4 changes: 2 additions & 2 deletions spec/expected/build/initial/attribute.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['attribute']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['attribute']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -207,4 +207,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/attribute_expression.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['attribute_expression']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['attribute_expression']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -298,4 +298,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/block_for_include.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['block_for_include']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['block_for_include']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -118,4 +118,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/block_unsuspected_recursion.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['block_unsuspected_recursion']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['block_unsuspected_recursion']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -149,4 +149,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/block_with_include.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['block_with_include']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['block_with_include']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -134,4 +134,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/block_with_params.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['block_with_params']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['block_with_params']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -282,4 +282,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/blocks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['blocks']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['blocks']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -366,4 +366,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/call.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['call']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['call']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -121,4 +121,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/cdata.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['cdata']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['cdata']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -110,4 +110,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/choose.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['choose']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['choose']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -149,4 +149,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/comment.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['comment']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['comment']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -110,4 +110,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/doctype.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['doctype']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['doctype']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -110,4 +110,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/each.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['each']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['each']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -157,4 +157,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/element.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['element']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['element']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -475,4 +475,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/for.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['for']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['for']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -190,4 +190,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/if.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['if']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['if']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -149,4 +149,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/include.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['include']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['include']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -156,4 +156,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/include_foreach.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['include_foreach']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['include_foreach']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -126,4 +126,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/insert.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['insert']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['insert']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -110,4 +110,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/intercept.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['intercept']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['intercept']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -109,4 +109,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/issue_64.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['issue_64']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['issue_64']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -110,4 +110,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/message.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['message']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['message']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -146,4 +146,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/params.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['params']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['params']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -135,4 +135,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/plural.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['plural']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['plural']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -146,4 +146,4 @@
} else {
return __fest_buf;
}
}})();
};})();
4 changes: 2 additions & 2 deletions spec/expected/build/initial/plural_english.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;(function(){var x=Function('return this')();if(!x.fest)x.fest={};x.fest['plural_english']=function(__fest_context) {
;(function(){var x=Function('return this')();if(!x['fest'])x['fest']={};x['fest']['plural_english']=function(__fest_context) {
"use strict";
var __fest_self = this,
__fest_buf = "",
Expand Down Expand Up @@ -146,4 +146,4 @@
} else {
return __fest_buf;
}
}})();
};})();
Loading