clean: remove useless codes
This commit is contained in:
parent
0eaf9156de
commit
de6cfeeee3
|
@ -637,6 +637,8 @@ Of course, you can also write your own directives. Components such as
|
|||
当然,我们也能编写自己的指令。像`HeroListComponent`这样的组件就是一种自定义指令。
|
||||
|
||||
|
||||
<hr/>
|
||||
|
||||
## Services
|
||||
|
||||
## 服务
|
||||
|
|
|
@ -19,10 +19,6 @@ unexpected definitions.
|
|||
[J](guide/glossary#J) [K](guide/glossary#K) [L](guide/glossary#L) [M](guide/glossary#M) [N](guide/glossary#N) [O](guide/glossary#O) [P](guide/glossary#P) [Q](guide/glossary#Q) [R](guide/glossary#R)
|
||||
[S](guide/glossary#S) [T](guide/glossary#T) [U](guide/glossary#U) [V](guide/glossary#V) [W](guide/glossary#W) [X](guide/glossary#X) [Y](guide/glossary#Y) [Z](guide/glossary#Z)
|
||||
|
||||
索引:[A](guide/glossary#A) [B](guide/glossary#B) [C](guide/glossary#C) [D](guide/glossary#D) [E](guide/glossary#E) [F](guide/glossary#F) [G](guide/glossary#G) [H](guide/glossary#H) [I](guide/glossary#I)
|
||||
[J](guide/glossary#J) [K](guide/glossary#K) [L](guide/glossary#L) [M](guide/glossary#M) [N](guide/glossary#N) [O](guide/glossary#O) [P](guide/glossary#P) [Q](guide/glossary#Q) [R](guide/glossary#R)
|
||||
[S](guide/glossary#S) [T](guide/glossary#T) [U](guide/glossary#U) [V](guide/glossary#V) [W](guide/glossary#W) [X](guide/glossary#X) [Y](guide/glossary#Y) [Z](guide/glossary#Z)
|
||||
|
||||
{@a A}
|
||||
{@a aot}
|
||||
|
||||
|
|
|
@ -797,7 +797,9 @@ time to incorporate that translation into the application.
|
|||
|
||||
整个模板的翻译就完成了。现在就该把翻译结果放回到应用程序中了。
|
||||
|
||||
### The app before translation<a id='app-pre-translation'></a>
|
||||
<a id='app-pre-translation'></a>
|
||||
|
||||
### The app before translation
|
||||
|
||||
### 翻译前的应用程序
|
||||
|
||||
|
|
|
@ -2425,7 +2425,7 @@ Angular 创建一个惰性加载模块,它具有自己的注入器,它是根
|
|||
You made it! You can examine and download the complete source for this final version from the live example.
|
||||
|
||||
完工!你可以到下面的在线例子中试验它,并下载最终版本的全部源码。
|
||||
<br/>
|
||||
|
||||
<live-example embedded img="guide/ngmodule/final-plunker.png"></live-example>
|
||||
|
||||
## Frequently asked questions
|
||||
|
|
|
@ -17,8 +17,8 @@ Node.js and npm are essential to Angular development.
|
|||
|
||||
Node.js和npm是做Angular开发的基础。
|
||||
|
||||
<p><a href="https://docs.npmjs.com/getting-started/installing-node" title="Installing Node.js and updating npm">
|
||||
Get them now</a> if they're not already installed on your machine.</p>
|
||||
<a href="https://docs.npmjs.com/getting-started/installing-node" title="Installing Node.js and updating npm">
|
||||
Get them now</a> if they're not already installed on your machine.
|
||||
|
||||
如果你的电脑上还没有装过,请<a href="https://docs.npmjs.com/getting-started/installing-node" target="_blank" title="Installing Node.js and updating npm">立即获取它</a>!
|
||||
|
||||
|
|
|
@ -70,7 +70,9 @@ For more information, see the [Trusting safe values](guide/security#bypass-secur
|
|||
**避免使用本文档中带“[_安全风险_](guide/security#bypass-security-apis)”标记的Angular API。**
|
||||
要了解更多信息,请参阅本章的[信任那些安全的值](guide/security#bypass-security-apis)部分。
|
||||
|
||||
## Preventing cross-site scripting (XSS) <a id="xss"></a>
|
||||
<a id="xss"></a>
|
||||
|
||||
## Preventing cross-site scripting (XSS)
|
||||
|
||||
## 防范跨站脚本(XSS)攻击
|
||||
|
||||
|
|
|
@ -12,10 +12,9 @@ import {
|
|||
OnDestroy,
|
||||
Output,
|
||||
} from '@angular/core';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { DocumentContents } from 'app/documents/document.service';
|
||||
|
||||
import { EmbeddedComponents } from 'app/embedded/embedded.module';
|
||||
import { DocumentContents } from 'app/documents/document.service';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { TocService } from 'app/shared/toc.service';
|
||||
|
||||
interface EmbeddedComponentFactory {
|
||||
|
|
|
@ -2,7 +2,7 @@ const remark = require('remark');
|
|||
const html = require('remark-html');
|
||||
const code = require('./handlers/code');
|
||||
|
||||
const {markAndSwap} = require('./translator');
|
||||
const {mark} = require('./translator');
|
||||
|
||||
/**
|
||||
* @dgService renderMarkdown
|
||||
|
@ -22,7 +22,7 @@ module.exports = function renderMarkdown() {
|
|||
.use(html, { handlers });
|
||||
|
||||
return function renderMarkdownImpl(content) {
|
||||
return markAndSwap(renderer.processSync(content).toString());
|
||||
return mark(renderer.processSync(content).toString());
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,20 +5,10 @@ function mark(text) {
|
|||
});
|
||||
}
|
||||
|
||||
function swap(text) {
|
||||
return text.replace(/<(\w+)( translation-origin\b[\s\S]*?)<\/\1>(\s*)<\1( translation-result\b[\s\S]*?)<\/\1>/gi, '<$1$4</$1>$3<$1$2</$1>');
|
||||
}
|
||||
|
||||
function markAndSwap(text) {
|
||||
return mark(text);
|
||||
}
|
||||
|
||||
function isTranslation(text) {
|
||||
return text && /[\u2E80-\u2EFF\u2F00-\u2FDF\u3000-\u303F\u31C0-\u31EF\u3200-\u32FF\u3300-\u33FF\u3400-\u4DBF\u4DC0-\u4DFF\u4E00-\u9FBF\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFFEF]/.test(text);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
mark,
|
||||
swap,
|
||||
markAndSwap,
|
||||
};
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
// TODO: replace mocha with jasmine
|
||||
const { expect } = require('chai');
|
||||
|
||||
const { mark, swap } = require('./translator');
|
||||
const { mark} = require('./translator');
|
||||
|
||||
it('mark translation results and origins', () => {
|
||||
expect(mark('<h1>AngularJS to Angular</h1>\n<h1>从 AngularJS 到 Angular 快速参考</h1>'))
|
||||
.equal('<h1 translation-origin=off >AngularJS to Angular</h1>\n<h1 translation-result >从 AngularJS 到 Angular 快速参考</h1>');
|
||||
});
|
||||
|
||||
it('swap result and origin', () => {
|
||||
expect(swap('<h1 translation-origin=off >AngularJS to Angular</h1>\n<h1 translation-result >从 AngularJS 到 Angular 快速参考</h1>'))
|
||||
.equal('<h1 translation-result >从 AngularJS 到 Angular 快速参考</h1>\n<h1 translation-origin=off >AngularJS to Angular</h1>');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue