Permalink
Browse files

Merge branch 'performance'

  • Loading branch information...
2 parents a799c44 + 4f7591b commit 7539d70f2b9b20bc84903d0ca59f10a14217a1cc @akaspin committed May 16, 2010
Showing with 19 additions and 15 deletions.
  1. +8 −8 lib/compiler.js
  2. +2 −3 readme.md
  3. +4 −4 test/fixtures/complex.html
  4. +5 −0 test/test-complex.js
View
@@ -104,8 +104,8 @@ function static_section(hStream, id, target, context, action) {
for (var i = 0; i < target.length; i++) {
var subid = streamId + "/" + i;
hStream.map(subid);
- var oproto = insertProto(deepClone(target[i]), context);
- action(subid, oproto);
+ //var oproto = insertProto(deepClone(target[i]), context);
+ action(subid, target[i]);
hStream.end(subid);
}
hStream.end(id);
@@ -127,8 +127,8 @@ function static_section(hStream, id, target, context, action) {
if (!Object.keys(target).length){
hStream.write(id, "");
} else {
- var oproto = insertProto(deepClone(target), context);
- action(id + "/", oproto);
+ //var oproto = insertProto(deepClone(target), context);
+ action(id + "/", context);
hStream.end(id);
}
} else {
@@ -167,10 +167,10 @@ function lookup(hStream, id, target, context) {
};
if (typeof target === 'function'){ // Lambda
var target = target(context);
- var oproto = insertProto(deepClone(target), context);
+ //var oproto = insertProto(deepClone(target), context);
if (typeof target === 'function') { // Async
hStream.lambda(id, function(data, callback) {
- target(oproto, function(err, data) {
+ target(context, function(err, data) {
callback(out(data));
}); });
hStream.write(id, "");
@@ -206,10 +206,10 @@ function unescaped(hStream, id, target, context) {
};
if (typeof target === 'function'){ // Lambda
var target = target(context);
- var oproto = insertProto(deepClone(target), context);
+ //var oproto = insertProto(deepClone(target), context);
if (typeof target === 'function') { // Async
hStream.lambda(id, function(data, callback) {
- target(oproto, function(err, data) {
+ target(context, function(err, data) {
callback(out(data));
}); });
hStream.write(id, "");
View
@@ -155,9 +155,8 @@ context and callback. Callback receives two arguments: error and data.
Sections render blocks of text one or more times, depending on the value of the
key in the current context. A section begins with a pound `#` and ends with a
-slash `/`. Local context is defined by key and mixed into the global context
-for all nested tags. In sections with local context you can access to global
-context by placing dot `.` before tag id.
+slash `/`. Local context is defined by key. In sections with local context you
+can access to global context by placing dot `.` before tag id.
The behavior of the section is determined by the value of the key in context.
Value in context can be one of following:
@@ -1,14 +1,14 @@
<h1>{{header}}</h1>
{{#list}}
<ul>
- {{#item}}
+ {{#.item}}
{{#current}}
<li><strong>{{name}}</strong></li>
{{/current}}
- {{#link}}
+ {{#.link}}
<li><a href="{{url}}">{{name}}</a></li>
- {{/link}}
- {{/item}}
+ {{/.link}}
+ {{/.item}}
</ul>
{{/list}}
{{#empty}}
View
@@ -0,0 +1,5 @@
+var c = require("./common");
+
+var f = "complex";
+
+c.test(f);

0 comments on commit 7539d70

Please sign in to comment.