mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Marko v3: Adjusted indentation for object literals
This commit is contained in:
parent
b960ff73dd
commit
845ec98c98
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -8,8 +8,8 @@ function create(__helpers) {
|
||||
|
||||
return function render(data, out) {
|
||||
test_hello({
|
||||
name: "World"
|
||||
}, out);
|
||||
name: "World"
|
||||
}, out);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user