2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-14 18:42:24 +03:00

fix parse tags in brackets

This commit is contained in:
Nikolay Kostyurin
2018-07-12 23:21:22 +02:00
parent df87e56143
commit 0bea22d3ca
2 changed files with 39 additions and 4 deletions
@@ -53,6 +53,23 @@ describe('Tokenizer', () => {
expectOutput(output, tokens);
});
test('tokenize tags in brakets', () => {
const input = '[ [h1]G[/h1] ]';
const tokens = tokenize(input);
const output = [
[TYPE.WORD, '[', '0', '0'],
[TYPE.SPACE, ' ', '1', '0'],
[TYPE.TAG, 'h1', '2', '0'],
[TYPE.WORD, 'G', '1', '0'],
[TYPE.TAG, '/h1', '7', '0'],
[TYPE.SPACE, ' ', '12', '0'],
[TYPE.WORD, ']', '7', '0'],
];
expectOutput(output, tokens);
});
test('tokenize tag as param', () => {
const input = '[color="#ff0000"]Text[/color]';
const tokens = tokenize(input);