mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-17 19:21:20 +03:00
chore: v2.5.1 (#21)
* fix(parser): fix issue with escaping backslashes when enableEscapeTags is set (#20) there is a bug in the lexer where when enableEscapeTags is set, backslashes are not always escaped (ie. \\[b] is treated as an escaped tag, rather than a literal backslash, and then a tag). * chore: v2.5.1
This commit is contained in:
committed by
GitHub
parent
3b46fbe23c
commit
c4a88e5036
@@ -3,6 +3,23 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
<a name="2.5.1"></a>
|
||||||
|
## [2.5.1](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.1) (2019-06-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **parser:** fix issue with escaping backslashes when enableEscapeTags is set ([#20](https://github.com/JiLiZART/bbob/issues/20)) ([8a9e930](https://github.com/JiLiZART/bbob/commit/8a9e930))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **parse:** allow tags to be escaped with backslash ([#17](https://github.com/JiLiZART/bbob/issues/17)) ([c4f78c1](https://github.com/JiLiZART/bbob/commit/c4f78c1))
|
||||||
|
* **preset-html5:** list type attribute support ([#18](https://github.com/JiLiZART/bbob/issues/18)) ([847c55e](https://github.com/JiLiZART/bbob/commit/847c55e))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.5.0"></a>
|
<a name="2.5.0"></a>
|
||||||
# [2.5.0](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.0) (2019-06-17)
|
# [2.5.0](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.0) (2019-06-17)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -15,5 +15,5 @@
|
|||||||
"access": "public",
|
"access": "public",
|
||||||
"registry": "https://registry.npmjs.org/"
|
"registry": "https://registry.npmjs.org/"
|
||||||
},
|
},
|
||||||
"version": "2.5.0"
|
"version": "2.5.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
<a name="2.5.1"></a>
|
||||||
|
## [2.5.1](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.1) (2019-06-18)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @bbob/cli
|
||||||
|
|
||||||
<a name="2.5.0"></a>
|
<a name="2.5.0"></a>
|
||||||
# [2.5.0](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.0) (2019-06-17)
|
# [2.5.0](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.0) (2019-06-17)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bbob/cli",
|
"name": "@bbob/cli",
|
||||||
"version": "2.5.0",
|
"version": "2.5.1",
|
||||||
"description": "Comand line bbcode parser",
|
"description": "Comand line bbcode parser",
|
||||||
"main": "lib/cli.js",
|
"main": "lib/cli.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
"lib": "lib"
|
"lib": "lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bbob/html": "^2.5.0",
|
"@bbob/html": "^2.5.1",
|
||||||
"@bbob/preset-html5": "^2.5.0",
|
"@bbob/preset-html5": "^2.5.1",
|
||||||
"commander": "^2.15.1"
|
"commander": "^2.15.1"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
<a name="2.5.1"></a>
|
||||||
|
## [2.5.1](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.1) (2019-06-18)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @bbob/core
|
||||||
|
|
||||||
<a name="2.5.0"></a>
|
<a name="2.5.0"></a>
|
||||||
# [2.5.0](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.0) (2019-06-17)
|
# [2.5.0](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.0) (2019-06-17)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bbob/core",
|
"name": "@bbob/core",
|
||||||
"version": "2.5.0",
|
"version": "2.5.1",
|
||||||
"description": "⚡️Blazing fast BBCode transforming and parsing tool in pure javascript, no dependencies ",
|
"description": "⚡️Blazing fast BBCode transforming and parsing tool in pure javascript, no dependencies ",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"bbcode",
|
"bbcode",
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
"core"
|
"core"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bbob/parser": "^2.5.0"
|
"@bbob/parser": "^2.5.1"
|
||||||
},
|
},
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
<a name="2.5.1"></a>
|
||||||
|
## [2.5.1](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.1) (2019-06-18)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @bbob/html
|
||||||
|
|
||||||
<a name="2.5.0"></a>
|
<a name="2.5.0"></a>
|
||||||
# [2.5.0](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.0) (2019-06-17)
|
# [2.5.0](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.0) (2019-06-17)
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "@bbob/html",
|
"name": "@bbob/html",
|
||||||
"version": "2.5.0",
|
"version": "2.5.1",
|
||||||
"description": "HTML renderer for @bbob bbcode parser",
|
"description": "HTML renderer for @bbob bbcode parser",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bbob/core": "^2.5.0",
|
"@bbob/core": "^2.5.1",
|
||||||
"@bbob/plugin-helper": "^2.4.0"
|
"@bbob/plugin-helper": "^2.4.0"
|
||||||
},
|
},
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
|
|||||||
@@ -3,6 +3,22 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
<a name="2.5.1"></a>
|
||||||
|
## [2.5.1](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.1) (2019-06-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **parser:** fix issue with escaping backslashes when enableEscapeTags is set ([#20](https://github.com/JiLiZART/bbob/issues/20)) ([8a9e930](https://github.com/JiLiZART/bbob/commit/8a9e930))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **parse:** allow tags to be escaped with backslash ([#17](https://github.com/JiLiZART/bbob/issues/17)) ([c4f78c1](https://github.com/JiLiZART/bbob/commit/c4f78c1))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.5.0"></a>
|
<a name="2.5.0"></a>
|
||||||
# [2.5.0](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.0) (2019-06-17)
|
# [2.5.0](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.0) (2019-06-17)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bbob/parser",
|
"name": "@bbob/parser",
|
||||||
"version": "2.5.0",
|
"version": "2.5.1",
|
||||||
"description": "Just parses BBcode to AST array. Part of @bbob bbcode parser",
|
"description": "Just parses BBcode to AST array. Part of @bbob bbcode parser",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"bbcode",
|
"bbcode",
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ function createLexer(buffer, options = {}) {
|
|||||||
const RESERVED_CHARS = [closeTag, openTag, QUOTEMARK, BACKSLASH, SPACE, TAB, EQ, N, EM];
|
const RESERVED_CHARS = [closeTag, openTag, QUOTEMARK, BACKSLASH, SPACE, TAB, EQ, N, EM];
|
||||||
const NOT_CHAR_TOKENS = [
|
const NOT_CHAR_TOKENS = [
|
||||||
...(options.enableEscapeTags ? [BACKSLASH] : []),
|
...(options.enableEscapeTags ? [BACKSLASH] : []),
|
||||||
openTag, SPACE, TAB, N, BACKSLASH,
|
openTag, SPACE, TAB, N,
|
||||||
];
|
];
|
||||||
const WHITESPACES = [SPACE, TAB];
|
const WHITESPACES = [SPACE, TAB];
|
||||||
const SPECIAL_CHARS = [EQ, SPACE, TAB];
|
const SPECIAL_CHARS = [EQ, SPACE, TAB];
|
||||||
@@ -163,6 +163,10 @@ function createLexer(buffer, options = {}) {
|
|||||||
bufferGrabber.skip(); // skip the \ without emitting anything
|
bufferGrabber.skip(); // skip the \ without emitting anything
|
||||||
bufferGrabber.skip(); // skip past the [ or ] as well
|
bufferGrabber.skip(); // skip past the [ or ] as well
|
||||||
emitToken(createToken(TYPE_WORD, nextChar, row, col));
|
emitToken(createToken(TYPE_WORD, nextChar, row, col));
|
||||||
|
} else if (options.enableEscapeTags && currChar === BACKSLASH && nextChar === BACKSLASH) {
|
||||||
|
bufferGrabber.skip(); // skip the first \ without emitting anything
|
||||||
|
bufferGrabber.skip(); // skip past the second \ and emit it
|
||||||
|
emitToken(createToken(TYPE_WORD, nextChar, row, col));
|
||||||
} else if (currChar === openTag) {
|
} else if (currChar === openTag) {
|
||||||
bufferGrabber.skip(); // skip openTag
|
bufferGrabber.skip(); // skip openTag
|
||||||
|
|
||||||
|
|||||||
@@ -305,6 +305,29 @@ describe('lexer', () => {
|
|||||||
expectOutput(output, tokens);
|
expectOutput(output, tokens);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('escaped tag and escaped backslash', () => {
|
||||||
|
const tokenizeEscape = input => (createLexer(input, {
|
||||||
|
enableEscapeTags: true
|
||||||
|
}).tokenize());
|
||||||
|
const input = '\\\\\\[b\\\\\\]test\\\\\\[/b\\\\\\]';
|
||||||
|
const tokens = tokenizeEscape(input);
|
||||||
|
const output = [
|
||||||
|
[TYPE.WORD, '\\', '0', '0'],
|
||||||
|
[TYPE.WORD, '[', '0', '0'],
|
||||||
|
[TYPE.WORD, 'b', '0', '0'],
|
||||||
|
[TYPE.WORD, '\\', '0', '0'],
|
||||||
|
[TYPE.WORD, ']', '0', '0'],
|
||||||
|
[TYPE.WORD, 'test', '0', '0'],
|
||||||
|
[TYPE.WORD, '\\', '0', '0'],
|
||||||
|
[TYPE.WORD, '[', '0', '0'],
|
||||||
|
[TYPE.WORD, '/b', '0', '0'],
|
||||||
|
[TYPE.WORD, '\\', '0', '0'],
|
||||||
|
[TYPE.WORD, ']', '0', '0'],
|
||||||
|
];
|
||||||
|
|
||||||
|
expectOutput(output, tokens);
|
||||||
|
});
|
||||||
|
|
||||||
describe('html', () => {
|
describe('html', () => {
|
||||||
const tokenizeHTML = input => createLexer(input, { openTag: '<', closeTag: '>' }).tokenize();
|
const tokenizeHTML = input => createLexer(input, { openTag: '<', closeTag: '>' }).tokenize();
|
||||||
|
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ describe('Parser', () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('parse escaped tags tags', () => {
|
test('parse escaped tags', () => {
|
||||||
const ast = parse('\\[b\\]test\\[/b\\]', {
|
const ast = parse('\\[b\\]test\\[/b\\]', {
|
||||||
enableEscapeTags: true
|
enableEscapeTags: true
|
||||||
});
|
});
|
||||||
@@ -199,5 +199,25 @@ describe('Parser', () => {
|
|||||||
']',
|
']',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('parse escaped tags and escaped backslash', () => {
|
||||||
|
const ast = parse('\\\\\\[b\\\\\\]test\\\\\\[/b\\\\\\]', {
|
||||||
|
enableEscapeTags: true
|
||||||
|
});
|
||||||
|
|
||||||
|
expectOutput(ast, [
|
||||||
|
'\\',
|
||||||
|
'[',
|
||||||
|
'b',
|
||||||
|
'\\',
|
||||||
|
']',
|
||||||
|
'test',
|
||||||
|
'\\',
|
||||||
|
'[',
|
||||||
|
'/b',
|
||||||
|
'\\',
|
||||||
|
']',
|
||||||
|
]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,6 +3,17 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
<a name="2.5.1"></a>
|
||||||
|
## [2.5.1](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.1) (2019-06-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **preset-html5:** list type attribute support ([#18](https://github.com/JiLiZART/bbob/issues/18)) ([847c55e](https://github.com/JiLiZART/bbob/commit/847c55e))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="2.5.0"></a>
|
<a name="2.5.0"></a>
|
||||||
# [2.5.0](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.0) (2019-06-17)
|
# [2.5.0](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.0) (2019-06-17)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bbob/preset-html5",
|
"name": "@bbob/preset-html5",
|
||||||
"version": "2.5.0",
|
"version": "2.5.1",
|
||||||
"description": "HTML5 preset to transform BBCode to HTML for @bbob/parser",
|
"description": "HTML5 preset to transform BBCode to HTML for @bbob/parser",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"preset",
|
"preset",
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
"@bbob/preset": "^2.4.0"
|
"@bbob/preset": "^2.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@bbob/html": "^2.5.0"
|
"@bbob/html": "^2.5.1"
|
||||||
},
|
},
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
<a name="2.5.1"></a>
|
||||||
|
## [2.5.1](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.1) (2019-06-18)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @bbob/preset-react
|
||||||
|
|
||||||
<a name="2.5.0"></a>
|
<a name="2.5.0"></a>
|
||||||
# [2.5.0](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.0) (2019-06-17)
|
# [2.5.0](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.0) (2019-06-17)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bbob/preset-react",
|
"name": "@bbob/preset-react",
|
||||||
"version": "2.5.0",
|
"version": "2.5.1",
|
||||||
"description": "React preset to transform BBCode to React for @bbob/react",
|
"description": "React preset to transform BBCode to React for @bbob/react",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"bbob",
|
"bbob",
|
||||||
@@ -8,10 +8,10 @@
|
|||||||
"react"
|
"react"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bbob/preset-html5": "^2.5.0"
|
"@bbob/preset-html5": "^2.5.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@bbob/core": "^2.5.0"
|
"@bbob/core": "^2.5.1"
|
||||||
},
|
},
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
<a name="2.5.1"></a>
|
||||||
|
## [2.5.1](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.1) (2019-06-18)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @bbob/react
|
||||||
|
|
||||||
<a name="2.5.0"></a>
|
<a name="2.5.0"></a>
|
||||||
# [2.5.0](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.0) (2019-06-17)
|
# [2.5.0](https://github.com/JiLiZART/bbob/compare/v2.4.1...v2.5.0) (2019-06-17)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bbob/react",
|
"name": "@bbob/react",
|
||||||
"version": "2.5.0",
|
"version": "2.5.1",
|
||||||
"description": "Render BBCode to React using @bbob/parser",
|
"description": "Render BBCode to React using @bbob/parser",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
@@ -9,8 +9,8 @@
|
|||||||
"bbob"
|
"bbob"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bbob/core": "^2.5.0",
|
"@bbob/core": "^2.5.1",
|
||||||
"@bbob/html": "^2.5.0",
|
"@bbob/html": "^2.5.1",
|
||||||
"@bbob/plugin-helper": "^2.4.0"
|
"@bbob/plugin-helper": "^2.4.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
"react": "15.x"
|
"react": "15.x"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@bbob/preset-react": "^2.5.0",
|
"@bbob/preset-react": "^2.5.1",
|
||||||
"enzyme": "^3.9.0",
|
"enzyme": "^3.9.0",
|
||||||
"enzyme-adapter-react-15": "^1.0.6",
|
"enzyme-adapter-react-15": "^1.0.6",
|
||||||
"react": "15.x",
|
"react": "15.x",
|
||||||
|
|||||||
Reference in New Issue
Block a user