fix: 不再拆解单行的 header 元素
This commit is contained in:
parent
a4ac40b640
commit
8a17495616
|
@ -217,42 +217,36 @@ ng generate directive highlight
|
|||
|
||||
it('拆解多行的成对 tag', function () {
|
||||
const lines = normalizeLines(`
|
||||
<header>
|
||||
Angular forms don't require a style library
|
||||
</header>
|
||||
<p>
|
||||
a
|
||||
</p>
|
||||
|
||||
<p>
|
||||
一
|
||||
</p>
|
||||
|
||||
`);
|
||||
expect(lines).eq(`
|
||||
<header>
|
||||
<p>
|
||||
|
||||
Angular forms don't require a style library
|
||||
a
|
||||
|
||||
</header>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
一
|
||||
|
||||
</p>
|
||||
`);
|
||||
});
|
||||
|
||||
it('拆解多行的成对 tag', function () {
|
||||
it('不要拆解 header', function () {
|
||||
const lines = normalizeLines(`
|
||||
<p>
|
||||
a
|
||||
</p>
|
||||
|
||||
<p>
|
||||
一
|
||||
</p>
|
||||
|
||||
<header>Angular forms don't require a style library</header>
|
||||
`);
|
||||
expect(lines).eq(`
|
||||
<p>
|
||||
|
||||
a
|
||||
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
一
|
||||
|
||||
</p>
|
||||
<header>Angular forms don't require a style library</header>
|
||||
`);
|
||||
});
|
||||
|
||||
|
|
|
@ -78,8 +78,6 @@ export function normalizeLines(text: string): string {
|
|||
text = text.replace(atTagCommentPattern, '\n\n$1$2$3\n');
|
||||
const oneLineClosedTagPattern = /\n( *)<(hr)(\/?)>( *)(?=\n)/g;
|
||||
text = text.replace(oneLineClosedTagPattern, '\n\n$1<$2$3>$4\n');
|
||||
const multiLinePairedTagPattern = /\n( *)<(header)( *[^>\n]*)>\n*(.*?)\n*( *)<\/\2>( *)(?=\n)/g;
|
||||
text = text.replace(multiLinePairedTagPattern, '\n\n$1<$2$3>\n\n$4\n\n$5</$2>$6\n');
|
||||
|
||||
const trTagPattern = /( *)(<tr\b *[^>\n]*>)(.*)(<\/tr>)/g;
|
||||
text = text.replace(trTagPattern, '\n\n$1$2\n\n$1 $3\n\n$1$4\n\n');
|
||||
|
|
Loading…
Reference in New Issue