Skip to content

Commit

Permalink
Style tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Dec 31, 2012
1 parent f6496c8 commit a5d0199
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions mustache.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,15 @@
var value = this._cache[name];

if (!value) {
if (name === ".") {
if (name == '.') {
value = this.view;
} else {
var context = this;

while (context) {
if (name.indexOf(".") > 0) {
var names = name.split("."), i = 0;

if (name.indexOf('.') > 0) {
value = context.view;

var names = name.split('.'), i = 0;
while (value && i < names.length) {
value = value[names[i++]];
}
Expand Down Expand Up @@ -256,10 +254,10 @@
}
} else if (typeof value === 'function') {
var text = template == null ? null : template.slice(token[3], token[5]);
var result = value.call(context.view, text, function (template) {
value = value.call(context.view, text, function (template) {
return writer.render(template, context);
});
if (result != null) buffer += result;
if (value != null) buffer += value;
} else if (value) {
buffer += renderTokens(token[4], writer, context, template);
}
Expand Down

0 comments on commit a5d0199

Please sign in to comment.