@bbob/plugin-helper
Advanced tools
Comparing version 2.6.1 to 2.6.2
@@ -6,2 +6,18 @@ # Change Log | ||
## [2.6.2](https://github.com/JiLiZART/bbob/compare/v2.5.8...v2.6.2) (2020-12-16) | ||
### Bug Fixes | ||
* **parser:** dont process nested tags as string if parent is not allowed ([#84](https://github.com/JiLiZART/bbob/issues/84)) ([70ff2e6](https://github.com/JiLiZART/bbob/commit/70ff2e6660bb507f6ed57cb91e850b3879bdb7eb)) | ||
### Features | ||
* **parser:** rewrite lexer to make it faster ([#50](https://github.com/JiLiZART/bbob/issues/50)) ([772d422](https://github.com/JiLiZART/bbob/commit/772d422d770b0f7716a86ac82c10eb3baaf77828)) | ||
## [2.6.1](https://github.com/JiLiZART/bbob/compare/v2.5.8...v2.6.1) (2020-12-15) | ||
@@ -8,0 +24,0 @@ |
@@ -51,2 +51,19 @@ "use strict"; | ||
toTagStart(_temp) { | ||
var { | ||
openTag = _char.OPEN_BRAKET, | ||
closeTag = _char.CLOSE_BRAKET | ||
} = _temp === void 0 ? {} : _temp; | ||
var tagAttrs = getTagAttrs(this.tag, this.attrs); | ||
return "" + openTag + tagAttrs + closeTag; | ||
} | ||
toTagEnd(_temp2) { | ||
var { | ||
openTag = _char.OPEN_BRAKET, | ||
closeTag = _char.CLOSE_BRAKET | ||
} = _temp2 === void 0 ? {} : _temp2; | ||
return "" + openTag + _char.SLASH + this.tag + closeTag; | ||
} | ||
toTagNode() { | ||
@@ -56,14 +73,25 @@ return new TagNode(this.tag.toLowerCase(), this.attrs, this.content); | ||
toString() { | ||
var OB = _char.OPEN_BRAKET; | ||
var CB = _char.CLOSE_BRAKET; | ||
toString(_temp3) { | ||
var { | ||
openTag = _char.OPEN_BRAKET, | ||
closeTag = _char.CLOSE_BRAKET | ||
} = _temp3 === void 0 ? {} : _temp3; | ||
var isEmpty = this.content.length === 0; | ||
var content = this.content.reduce((r, node) => r + node.toString(), ''); | ||
var tagAttrs = getTagAttrs(this.tag, this.attrs); | ||
var content = this.content.reduce((r, node) => r + node.toString({ | ||
openTag, | ||
closeTag | ||
}), ''); | ||
var tagStart = this.toTagStart({ | ||
openTag, | ||
closeTag | ||
}); | ||
if (isEmpty) { | ||
return "" + OB + tagAttrs + CB; | ||
return tagStart; | ||
} | ||
return "" + OB + tagAttrs + CB + content + OB + _char.SLASH + this.tag + CB; | ||
return "" + tagStart + content + this.toTagEnd({ | ||
openTag, | ||
closeTag | ||
}); | ||
} | ||
@@ -70,0 +98,0 @@ |
@@ -55,2 +55,23 @@ "use strict"; | ||
_proto.toTagStart = function toTagStart(_temp) { | ||
var _ref = _temp === void 0 ? {} : _temp, | ||
_ref$openTag = _ref.openTag, | ||
openTag = _ref$openTag === void 0 ? _char.OPEN_BRAKET : _ref$openTag, | ||
_ref$closeTag = _ref.closeTag, | ||
closeTag = _ref$closeTag === void 0 ? _char.CLOSE_BRAKET : _ref$closeTag; | ||
var tagAttrs = getTagAttrs(this.tag, this.attrs); | ||
return "" + openTag + tagAttrs + closeTag; | ||
}; | ||
_proto.toTagEnd = function toTagEnd(_temp2) { | ||
var _ref2 = _temp2 === void 0 ? {} : _temp2, | ||
_ref2$openTag = _ref2.openTag, | ||
openTag = _ref2$openTag === void 0 ? _char.OPEN_BRAKET : _ref2$openTag, | ||
_ref2$closeTag = _ref2.closeTag, | ||
closeTag = _ref2$closeTag === void 0 ? _char.CLOSE_BRAKET : _ref2$closeTag; | ||
return "" + openTag + _char.SLASH + this.tag + closeTag; | ||
}; | ||
_proto.toTagNode = function toTagNode() { | ||
@@ -60,16 +81,29 @@ return new TagNode(this.tag.toLowerCase(), this.attrs, this.content); | ||
_proto.toString = function toString() { | ||
var OB = _char.OPEN_BRAKET; | ||
var CB = _char.CLOSE_BRAKET; | ||
_proto.toString = function toString(_temp3) { | ||
var _ref3 = _temp3 === void 0 ? {} : _temp3, | ||
_ref3$openTag = _ref3.openTag, | ||
openTag = _ref3$openTag === void 0 ? _char.OPEN_BRAKET : _ref3$openTag, | ||
_ref3$closeTag = _ref3.closeTag, | ||
closeTag = _ref3$closeTag === void 0 ? _char.CLOSE_BRAKET : _ref3$closeTag; | ||
var isEmpty = this.content.length === 0; | ||
var content = this.content.reduce(function (r, node) { | ||
return r + node.toString(); | ||
return r + node.toString({ | ||
openTag: openTag, | ||
closeTag: closeTag | ||
}); | ||
}, ''); | ||
var tagAttrs = getTagAttrs(this.tag, this.attrs); | ||
var tagStart = this.toTagStart({ | ||
openTag: openTag, | ||
closeTag: closeTag | ||
}); | ||
if (isEmpty) { | ||
return "" + OB + tagAttrs + CB; | ||
return tagStart; | ||
} | ||
return "" + OB + tagAttrs + CB + content + OB + _char.SLASH + this.tag + CB; | ||
return "" + tagStart + content + this.toTagEnd({ | ||
openTag: openTag, | ||
closeTag: closeTag | ||
}); | ||
}; | ||
@@ -76,0 +110,0 @@ |
{ | ||
"name": "@bbob/plugin-helper", | ||
"version": "2.6.1", | ||
"version": "2.6.2", | ||
"description": "Set of utils to help write plugins for @bbob/core", | ||
@@ -57,3 +57,3 @@ "keywords": [ | ||
], | ||
"gitHead": "58e6fba8ac5ac8fe368cade48d439671f86e727d" | ||
"gitHead": "689d5a84cc6b88e96fe74481bb82997d924799fd" | ||
} |
@@ -46,2 +46,12 @@ import { OPEN_BRAKET, CLOSE_BRAKET, SLASH } from './char'; | ||
toTagStart({ openTag = OPEN_BRAKET, closeTag = CLOSE_BRAKET } = {}) { | ||
const tagAttrs = getTagAttrs(this.tag, this.attrs); | ||
return `${openTag}${tagAttrs}${closeTag}`; | ||
} | ||
toTagEnd({ openTag = OPEN_BRAKET, closeTag = CLOSE_BRAKET } = {}) { | ||
return `${openTag}${SLASH}${this.tag}${closeTag}`; | ||
} | ||
toTagNode() { | ||
@@ -51,14 +61,12 @@ return new TagNode(this.tag.toLowerCase(), this.attrs, this.content); | ||
toString() { | ||
const OB = OPEN_BRAKET; | ||
const CB = CLOSE_BRAKET; | ||
toString({ openTag = OPEN_BRAKET, closeTag = CLOSE_BRAKET } = {}) { | ||
const isEmpty = this.content.length === 0; | ||
const content = this.content.reduce((r, node) => r + node.toString(), ''); | ||
const tagAttrs = getTagAttrs(this.tag, this.attrs); | ||
const content = this.content.reduce((r, node) => r + node.toString({ openTag, closeTag }), ''); | ||
const tagStart = this.toTagStart({ openTag, closeTag }); | ||
if (isEmpty) { | ||
return `${OB}${tagAttrs}${CB}`; | ||
return tagStart; | ||
} | ||
return `${OB}${tagAttrs}${CB}${content}${OB}${SLASH}${this.tag}${CB}`; | ||
return `${tagStart}${content}${this.toTagEnd({ openTag, closeTag })}`; | ||
} | ||
@@ -65,0 +73,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31625
708