add more softbreak rules
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2d1fbf4be2
commit
2570793058
2 changed files with 11 additions and 1 deletions
|
@ -39,6 +39,12 @@ Deno.test({
|
||||||
ren.render(E("p", [], [E("span", [], "hello"), "world"])),
|
ren.render(E("p", [], [E("span", [], "hello"), "world"])),
|
||||||
"<p><span>hello</span> world</p>",
|
"<p><span>hello</span> world</p>",
|
||||||
);
|
);
|
||||||
|
assertEquals(
|
||||||
|
ren.render(
|
||||||
|
E("p", [], ["Always up-to-date link to", E("a", [], "resume"), "."]),
|
||||||
|
),
|
||||||
|
"<p>Always up-to-date link to <a>resume</a>.</p>",
|
||||||
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,11 @@ function encodeHtmlElement(
|
||||||
}
|
}
|
||||||
|
|
||||||
function concatEncodedNodes(encodedChildren: string[]): string {
|
function concatEncodedNodes(encodedChildren: string[]): string {
|
||||||
return join(" ", encodedChildren).replace(/>\s+?</g, "><");
|
return join(" ", encodedChildren)
|
||||||
|
// Don't use softbreak between elements
|
||||||
|
.replace(/>\s+?</g, "><")
|
||||||
|
// Don't use softbreak after element if text starts with symbol
|
||||||
|
.replace(/> (\W)/g, ">$1");
|
||||||
}
|
}
|
||||||
|
|
||||||
function encodeAttrs(
|
function encodeAttrs(
|
||||||
|
|
Reference in a new issue