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/09/02 15:33:39 UTC

[incubator-echarts-doc] 01/02: tweak formatter and patch scripts

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

commit a2e390c959ae62ff02dcdf4eda5f5a9af16e81cc
Author: pissang <bm...@gmail.com>
AuthorDate: Wed Sep 2 23:21:40 2020 +0800

    tweak formatter and patch scripts
---
 tool/format.js        | 9 +++++----
 tool/patchLanguage.js | 4 ++++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/tool/format.js b/tool/format.js
index ebf2a86..bc41167 100644
--- a/tool/format.js
+++ b/tool/format.js
@@ -7,12 +7,13 @@ const path = require('path');
 const {compositeTargets} = require('../editor/common/blockHelper');
 const {parseBlocks} = require('../editor/common/parseBlocks');
 
-for (let lang of ['zh', 'en']) {
-    parseBlocks(path.resolve(__dirname, `../${lang}/option`)).then(function (json) {
+(async function () {
+    for (let lang of ['en', 'zh']) {
+        const json = await parseBlocks(path.resolve(__dirname, `../${lang}/option`), true);
         for (let fileName in json) {
             const fileTargets = json[fileName];
             const filePath = path.resolve(__dirname, `../${lang}/option/`, fileName.replace('.', '/')) + '.md';
             fs.writeFileSync(filePath, compositeTargets(fileTargets), 'utf-8');
         }
-    });
-}
\ No newline at end of file
+    }
+})()
\ No newline at end of file
diff --git a/tool/patchLanguage.js b/tool/patchLanguage.js
index 01988ee..76637f2 100644
--- a/tool/patchLanguage.js
+++ b/tool/patchLanguage.js
@@ -26,6 +26,10 @@ function applyBlocksPatch(fromBlocks, toBlocks) {
         else {
             for (let i = 0; i < part.indices.length; i++) {
                 const fromBlock = fromBlocks[part.indices[i]];
+                // Just ignore uicontrol block.
+                if (fromBlock.type === 'uicontrol') {
+                    continue;
+                }
                 const block = _.clone(
                     part.added ? fromBlock    // New added content in zh doc
                         : toBlocks.find(a => a.key === fromBlock.key) // Keep not change


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org