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

feat(#271): whitespaceInTags mode (#272)

* fix: test for buggy behavior

* feat: implement whitespaceInTags mode

* feat: move all char arrays to Map

* feat: revert Map for char arrays
This commit is contained in:
Nikolay Kost
2025-03-09 02:23:03 +02:00
committed by GitHub
parent f0c9da683d
commit 0566241e23
5 changed files with 77 additions and 4 deletions
+37
View File
@@ -869,6 +869,43 @@ sdfasdfasdf
]);
});
test('parse invalid tags', () => {
const input = parse('[b]Press Release[/b] [statement redacted] [i]This is more content[/i]', {
whitespaceInTags: false
})
expectOutput(input, [
{
tag: 'b',
attrs: {},
content: [
'Press',
' ',
'Release'
],
},
' ',
'[',
'statement',
' ',
'redacted]',
' ',
{
tag: 'i',
attrs: {},
content: [
'This',
' ',
'is',
' ',
'more',
' ',
'content'
],
},
]);
})
describe('html', () => {
const parseHTML = (input: string) => parse(input, { openTag: '<', closeTag: '>' });