You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2020/08/31 03:27:07 UTC
[incubator-echarts-doc] branch next updated: feat(editor): optimize
formatted code
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-echarts-doc.git
The following commit(s) were added to refs/heads/next by this push:
new cc80237 feat(editor): optimize formatted code
cc80237 is described below
commit cc8023775db004b7722eea91430c03a95051d237
Author: pissang <bm...@gmail.com>
AuthorDate: Mon Aug 31 11:26:57 2020 +0800
feat(editor): optimize formatted code
---
editor/common/blockHelper.js | 13 +++++++------
editor/server/parseBlocks.js | 1 +
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/editor/common/blockHelper.js b/editor/common/blockHelper.js
index 808255e..634d395 100644
--- a/editor/common/blockHelper.js
+++ b/editor/common/blockHelper.js
@@ -1,5 +1,8 @@
function parseArgKv(str) {
- const idx = str.indexOf('=');
+ let idx = str.indexOf('=');
+ if (idx < 0) {
+ idx = str.indexOf(':');
+ }
return [
str.substr(0, idx).trim(),
str.substr(idx + 1).trim()
@@ -184,7 +187,7 @@ module.exports.blockCompositors = {
if (block.propertyDefault) {
ret = ret + ' = ' + block.propertyDefault;
}
- return ret;
+ return ret + '\n';
},
use(block) {
// Do some format and code indention
@@ -195,13 +198,11 @@ module.exports.blockCompositors = {
${argsStr}
`;
}
- return `
-{{ use: ${block.target}(${argsStr}) }}
+ return `{{ use: ${block.target}(${argsStr}) }}
`;
},
content(block) {
- return `
-${block.value}
+ return `${block.value}
`;
}
}
diff --git a/editor/server/parseBlocks.js b/editor/server/parseBlocks.js
index 2f6e80c..8115e9f 100644
--- a/editor/server/parseBlocks.js
+++ b/editor/server/parseBlocks.js
@@ -105,6 +105,7 @@ function compositeForCommand(command) {
for (const subCmd of command.children) {
text += compositeCommand(subCmd);
}
+ text += `{{ /for }}`;
return text;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org