From 8a1749561605c3d6b1369a6450ab8d879cc9e1c1 Mon Sep 17 00:00:00 2001 From: Zhicheng Wang Date: Sat, 24 Mar 2018 11:31:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=8D=E5=86=8D=E6=8B=86=E8=A7=A3?= =?UTF-8?q?=E5=8D=95=E8=A1=8C=E7=9A=84=20header=20=E5=85=83=E7=B4=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aio/tools/translator/utils.spec.ts | 46 +++++++++++++----------------- aio/tools/translator/utils.ts | 2 -- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/aio/tools/translator/utils.spec.ts b/aio/tools/translator/utils.spec.ts index 232c428578..fce9fe0cc3 100644 --- a/aio/tools/translator/utils.spec.ts +++ b/aio/tools/translator/utils.spec.ts @@ -217,42 +217,36 @@ ng generate directive highlight it('拆解多行的成对 tag', function () { const lines = normalizeLines(` -
- Angular forms don't require a style library -
+

+ a +

+ +

+ 一 +

+ `); expect(lines).eq(` -
+

- Angular forms don't require a style library + a -

+

+ +

+ + 一 + +

`); }); - it('拆解多行的成对 tag', function () { + it('不要拆解 header', function () { const lines = normalizeLines(` -

- a -

- -

- 一 -

- +
Angular forms don't require a style library
`); expect(lines).eq(` -

- - a - -

- -

- - 一 - -

+
Angular forms don't require a style library
`); }); diff --git a/aio/tools/translator/utils.ts b/aio/tools/translator/utils.ts index 05afae62b0..ba67cd8d70 100644 --- a/aio/tools/translator/utils.ts +++ b/aio/tools/translator/utils.ts @@ -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$6\n'); const trTagPattern = /( *)(\n]*>)(.*)(<\/tr>)/g; text = text.replace(trTagPattern, '\n\n$1$2\n\n$1 $3\n\n$1$4\n\n');