Skip to content

Commit 9fb9368

Browse files
authored
Merge pull request #59 from posthtml/milestone-2.0.4
Milestone 2.0.4
2 parents e7f8d33 + 698e31f commit 9fb9368

5 files changed

Lines changed: 55 additions & 4 deletions

File tree

changelog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
## <small>2.0.4 (2021-06-08)</small>
2+
3+
* perf: engine up to 12 version ([7c430be](https://github.com/posthtml/posthtml-render/commit/7c430be))
4+
* fix: if tree contains empty string, close #58 ([401f5a6](https://github.com/posthtml/posthtml-render/commit/401f5a6)), closes [#58](https://github.com/posthtml/posthtml-render/issues/58)
5+
* test: if tree exists empty string, issue #58 ([3493d4f](https://github.com/posthtml/posthtml-render/commit/3493d4f)), closes [#58](https://github.com/posthtml/posthtml-render/issues/58)
6+
7+
8+
19
## <small>2.0.3 (2021-06-04)</small>
210

11+
* 2.0.3 ([f5cd69d](https://github.com/posthtml/posthtml-render/commit/f5cd69d))
312
* test: if in content has empty array, issue #56 ([95bad06](https://github.com/posthtml/posthtml-render/commit/95bad06)), closes [#56](https://github.com/posthtml/posthtml-render/issues/56)
413
* fix: if in content has empty array, close #56 ([892d602](https://github.com/posthtml/posthtml-render/commit/892d602)), closes [#56](https://github.com/posthtml/posthtml-render/issues/56)
514

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "posthtml-render",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"description": "Renders PostHTML Tree to HTML/XML",
55
"license": "MIT",
66
"repository": "posthtml/posthtml-render",
77
"author": "Ivan Voischev <voischev.ivan@ya.ru>",
88
"main": "dist/index.js",
99
"engines": {
10-
"node": ">=10"
10+
"node": ">=12"
1111
},
1212
"scripts": {
1313
"version": "conventional-changelog -i changelog.md -s -r 0 && git add changelog.md",

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function render(tree?: Node | Node[], options: Options = {}): string {
8080
(typeof node === 'string' && node.length === 0) ||
8181
Number.isNaN(node)
8282
) {
83-
break;
83+
continue;
8484
}
8585

8686
// Treat as new root tree if node is an array

test/test-core.spec.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,48 @@ test('{Tree} {Immutable}', t => {
237237
t.is(html1, html2);
238238
});
239239

240+
test('{Tree} {With empty string}', t => {
241+
const tree = [
242+
'',
243+
'<!doctype html>',
244+
'',
245+
{
246+
tag: 'html',
247+
attrs: {
248+
lang: 'en'
249+
},
250+
content: [
251+
'',
252+
{
253+
tag: 'head',
254+
content: [
255+
'',
256+
{
257+
tag: 'meta',
258+
attrs: {
259+
charset: 'utf-8'
260+
}
261+
},
262+
''
263+
]
264+
},
265+
'',
266+
{
267+
tag: 'body',
268+
content: [
269+
' '
270+
]
271+
},
272+
''
273+
]
274+
},
275+
''
276+
];
277+
const html = '<!doctype html><html lang="en"><head><meta charset="utf-8"></head><body> </body></html>';
278+
279+
t.is(render(tree), html);
280+
});
281+
240282
test('{Options} {singleTag} Defaults', t => {
241283
const SINGLE_TAGS_LOWERCASE = [
242284
'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'

0 commit comments

Comments
 (0)