fix: 拆解单行 br
This commit is contained in:
parent
8dcffab9c8
commit
4c10eb42b5
|
@ -101,6 +101,21 @@ def`);
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('拆解单行br', function () {
|
||||||
|
const lines = normalizeLines(`
|
||||||
|
a
|
||||||
|
<br class="clear">
|
||||||
|
b
|
||||||
|
`);
|
||||||
|
expect(lines).eql(`
|
||||||
|
a
|
||||||
|
|
||||||
|
<br class="clear">
|
||||||
|
|
||||||
|
b
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
|
||||||
it('拆解 @a 标记', function () {
|
it('拆解 @a 标记', function () {
|
||||||
const lines = normalizeLines(`
|
const lines = normalizeLines(`
|
||||||
a
|
a
|
||||||
|
|
|
@ -59,6 +59,8 @@ export function normalizeLines(text: string): string {
|
||||||
text = text.replace(oneLineThTdTagPattern, '\n\n$1<$2$3>\n\n$1$4\n\n$1</$2>$5\n\n');
|
text = text.replace(oneLineThTdTagPattern, '\n\n$1<$2$3>\n\n$1$4\n\n$1</$2>$5\n\n');
|
||||||
const oneLineCommentPattern = /\n( *)(<!--.*-->)( *)\n/g;
|
const oneLineCommentPattern = /\n( *)(<!--.*-->)( *)\n/g;
|
||||||
text = text.replace(oneLineCommentPattern, '\n\n$1$2$3\n\n');
|
text = text.replace(oneLineCommentPattern, '\n\n$1$2$3\n\n');
|
||||||
|
const oneLineBrTagPattern = /\n( *)(<br class="clear">)( *)\n/g;
|
||||||
|
text = text.replace(oneLineBrTagPattern, '\n\n$1$2$3\n\n');
|
||||||
const atTagCommentPattern = /\n( *)({@a.*})( *)\n/g;
|
const atTagCommentPattern = /\n( *)({@a.*})( *)\n/g;
|
||||||
text = text.replace(atTagCommentPattern, '\n\n$1$2$3\n\n');
|
text = text.replace(atTagCommentPattern, '\n\n$1$2$3\n\n');
|
||||||
const oneLineClosedTagPattern = /\n( *)<(hr|p)(\/?)>( *)\n/g;
|
const oneLineClosedTagPattern = /\n( *)<(hr|p)(\/?)>( *)\n/g;
|
||||||
|
|
Loading…
Reference in New Issue