Marko v3: Adjusted indentation for object literals

This commit is contained in:
Patrick Steele-Idem 2016-01-19 15:35:36 -07:00
parent b960ff73dd
commit 845ec98c98
7 changed files with 34 additions and 30 deletions

View File

@ -488,6 +488,7 @@ class Generator {
} else if (typeof value === 'number') {
this.write(value.toString());
} else if (typeof value === 'object') {
this.incIndent();
this.write('{\n');
this.incIndent();
@ -498,7 +499,7 @@ class Generator {
let v = value[k];
this.writeLineIndent();
if (isValidJavaScriptIdentifier(k)) {
this.write(k + ': ');
} else {
@ -521,6 +522,7 @@ class Generator {
this.decIndent();
this.writeLineIndent();
this.write('}');
this.decIndent();
}
}

View File

@ -16,6 +16,7 @@ class ObjectExpression extends Node {
return;
}
codegen.incIndent();
codegen.write('{\n');
codegen.incIndent();
@ -33,6 +34,7 @@ class ObjectExpression extends Node {
codegen.decIndent();
codegen.writeLineIndent();
codegen.write('}');
codegen.decIndent();
}
toJSON() {

View File

@ -2,9 +2,9 @@ var aString = "abc",
aNumber = 123,
aBoolean = false,
anObject = {
foo: "bar",
dynamic: data.name
},
foo: "bar",
dynamic: data.name
},
anArray = [
"foo",
data.name

View File

@ -8,11 +8,11 @@ function create(__helpers) {
return function render(data, out) {
test_body_function({
name: "World",
myBody: function myBody(foo, bar) {
out.w("This is the body content");
}
}, out);
name: "World",
myBody: function myBody(foo, bar) {
out.w("This is the body content");
}
}, out);
};
}

View File

@ -8,13 +8,13 @@ function create(__helpers) {
return function render(data, out) {
test_import_var({
name: "World",
foo: data.foo,
bar: data.bar,
renderBody: function renderBody(out) {
out.w("This is the body content");
}
}, out);
name: "World",
foo: data.foo,
bar: data.bar,
renderBody: function renderBody(out) {
out.w("This is the body content");
}
}, out);
};
}

View File

@ -8,8 +8,8 @@ function create(__helpers) {
return function render(data, out) {
test_hello({
name: "World"
}, out);
name: "World"
}, out);
};
}

View File

@ -10,21 +10,21 @@ function create(__helpers) {
return function render(data, out) {
test_nested_tags_overlay({
header: "data.header"
}, out, 0, function renderBody(out, test_nested_tags_overlay0) {
header: "data.header"
}, out, 0, function renderBody(out, test_nested_tags_overlay0) {
test_nested_tags_overlay_body({
className: "my-body",
renderBody: function renderBody(out) {
out.w("Body content");
}
}, out, test_nested_tags_overlay0);
className: "my-body",
renderBody: function renderBody(out) {
out.w("Body content");
}
}, out, test_nested_tags_overlay0);
test_nested_tags_overlay_footer({
className: "my-footer",
renderBody: function renderBody(out) {
out.w("Footer content");
}
}, out, test_nested_tags_overlay0);
className: "my-footer",
renderBody: function renderBody(out) {
out.w("Footer content");
}
}, out, test_nested_tags_overlay0);
});
};
}