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:35:11 UTC
[incubator-echarts-doc] branch next updated: editor: fix prefix
default was removed after format
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 8a08775 editor: fix prefix default was removed after format
8a08775 is described below
commit 8a08775e78e1bd1b27416151b2e1b3d3887ee0b9
Author: pissang <bm...@gmail.com>
AuthorDate: Mon Aug 31 11:34:59 2020 +0800
editor: fix prefix default was removed after format
---
editor/common/blockHelper.js | 10 +++++-----
editor/server/parseBlocks.js | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/editor/common/blockHelper.js b/editor/common/blockHelper.js
index 634d395..122f18a 100644
--- a/editor/common/blockHelper.js
+++ b/editor/common/blockHelper.js
@@ -65,7 +65,7 @@ module.exports.parseHeader = function (text) {
const propertyType = parts[3];
return {
- hasPrefix: !!parts[1],
+ prefixCode: (parts[1] || '').trim(),
propertyName,
propertyType,
propertyDefault
@@ -76,7 +76,7 @@ module.exports.parseHeader = function (text) {
if (parts) {
const propertyName = parts[2].trim();
return {
- hasPrefix: !!parts[1],
+ prefixCode: (parts[1] || '').trim(),
propertyName,
propertyDefault
}
@@ -116,10 +116,10 @@ module.exports.updateLevelAndKeyInBlocks = function (blocks, targetsMap) {
if (topLevel === 0) {
topLevel = currentLevel;
// TODO Not all have prefix?
- topLevelHasPrefix = block.hasPrefix;
+ topLevelHasPrefix = !!block.prefixCode;
}
- if (topLevelHasPrefix !== block.hasPrefix) {
+ if (topLevelHasPrefix !== !!block.prefixCode) {
throw new Error(`[${block.propertyName}] Must all includes prefix or not`);
}
break;
@@ -182,7 +182,7 @@ module.exports.buildBlockHierarchy = function (blocks) {
module.exports.blockCompositors = {
header(block) {
/* eslint-disable-next-line */
- const prefix = '#'.repeat(block.level) + (block.hasPrefix ? '${prefix}' : '');
+ const prefix = '#'.repeat(block.level) + (block.prefixCode ? block.prefixCode : '');
let ret = `${prefix} ${block.propertyName}(${block.propertyType || '*'})`;
if (block.propertyDefault) {
ret = ret + ' = ' + block.propertyDefault;
diff --git a/editor/server/parseBlocks.js b/editor/server/parseBlocks.js
index 8115e9f..be9319f 100644
--- a/editor/server/parseBlocks.js
+++ b/editor/server/parseBlocks.js
@@ -34,7 +34,7 @@ function parseMarkDown(mdStr) {
const headerText = headers[idx - 1].text.trim();
const headerLevel = headers[idx - 1].level;
- const {propertyName, propertyDefault, propertyType, hasPrefix} = parseHeader(headerText);
+ const {propertyName, propertyDefault, propertyType, prefixCode} = parseHeader(headerText);
blocks.push({
type: 'header',
@@ -43,7 +43,7 @@ function parseMarkDown(mdStr) {
propertyName,
propertyDefault,
propertyType,
- hasPrefix
+ prefixCode
});
}
const text = section.trim();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org