Skip to content

Commit cc4e444

Browse files
committed
change zh
1 parent 98b293b commit cc4e444

29 files changed

Lines changed: 736 additions & 145 deletions

‎en/core/animation.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ __params__
6464
* mode (Number):
6565

6666
the behaviour of `Command: class` is depend on `mode`, there is three types of the mode.
67-
- 1: the default mode, first add the class to element
67+
- 1: the default mode, first add the class to element, after `animationend` the remove it
6868
- 2: the command will first to add classes to element, then add classes-active at nextReflow to trigger animation. when `animationend` remove all of them.
6969
- 3: similar with mode 1, but mode 3 dont remove classes after animationend
7070

@@ -195,7 +195,7 @@ you can extend javascript-based Animation via `Component.animation(name, handle
195195
__Param__
196196

197197
- name (String): the name of the commandName
198-
- handle(Function): the command definition, you need return a [Function] to act animation. the [Function] accept one parent
198+
- handle(step): the command definition, you need return a [Function] to act animation. the [Function] accept one param `step`
199199

200200

201201
for example, we need fading animation.

‎en/core/computed.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ since version `0.2.4`, regularjs have added `computed property` support.
77
Although regularjs have the full support for `ES5 Expression`. in some case, the computed property may helping you to avoiding complicated wacher-binding.
88

99

10-
## Example
10+
## Usage
1111

1212
you can either passing `computed` property to `Component.extend` or `new Component`.
1313

‎en/core/filter.md‎

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,31 @@ __Example__
1919
date-format filter
2020

2121
```javascript
22-
// simplest date format
23-
Regular.filter("format",function(value, format){
24-
function fix(str){
25-
str = "" + (str || "");
26-
return str.length <= 1? "0" + str : str;
27-
}
28-
var maps = {
29-
'yyyy': function(date){return date.getFullYear()},
30-
'MM': function(date){return fix(date.getMonth() + 1); },
31-
'dd': function(date){ return fix(date.getDate()) },
32-
'HH': function(date){ return fix(date.getHours()) },
33-
'mm': function(date){ return fix(date.getMinutes())}
34-
}
35-
36-
var trunk = new RegExp(Object.keys(maps).join('|'),'g');
37-
return function(value, format){
38-
format = format || "yyyy-MM-dd HH:mm";
39-
value = new Date(value);
40-
41-
return format.replace(trunk, function(capture){
42-
return maps[capture]? maps[capture](value): "";
43-
});
44-
}
45-
})
22+
// simplest date format
23+
var filter = function(){
24+
function fix(str){
25+
str = "" + (str || "");
26+
return str.length <= 1? "0" + str : str;
27+
}
28+
var maps = {
29+
'yyyy': function(date){return date.getFullYear()},
30+
'MM': function(date){return fix(date.getMonth() + 1); },
31+
'dd': function(date){ return fix(date.getDate()) },
32+
'HH': function(date){ return fix(date.getHours()) },
33+
'mm': function(date){ return fix(date.getMinutes())}
34+
}
35+
36+
var trunk = new RegExp(Object.keys(maps).join('|'),'g');
37+
return function(value, format){
38+
format = format || "yyyy-MM-dd HH:mm";
39+
value = new Date(value);
40+
41+
return format.replace(trunk, function(capture){
42+
return maps[capture]? maps[capture](value): "";
43+
});
44+
}
45+
}();
46+
Regular.filter("format", filter)
4647
```
4748

4849
then

‎en/getting-start/install.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
#Installation
33

4-
> The global `Regular` object is always accessible within window.
54

65
## Download
76

@@ -18,7 +17,8 @@ __use bower__
1817

1918
__use component__
2019

21-
`component install regularjs/regular`
20+
* `component install regularjs/regular`
21+
* `var Regular = require('regularjs')`
2222

2323
## Usage
2424

@@ -28,6 +28,7 @@ __directly insert__
2828
<script src="path/to/regular.js"></script>
2929
```
3030

31+
`Regular` object is now accessible in window.
3132

3233
__use AMD loader__
3334

‎en/introduct/index.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ This page aims at helping you to find all the api in this guide
1212
2. [Component.directive](../core/directive.md): define a directive for Component and its SubComponent
1313
3. [Component.filter](../core/filter.md): define a filter for Component and its SubComponent
1414
4. [Component.event](../core/event.md): define a custom event for Component and its SubComponent
15-
5. [Component.use](../core/use.md): use a plugin
16-
6. [Regular.expression](../syntax/expression.html#expression): create a Expression form String at runtime
15+
5. [Component.animation](../core/animation.md): define a custom animation
16+
6. [Component.use](../core/use.md): use a plugin
17+
7. [Regular.expression](../syntax/expression.html#expression): create a Expression form String at runtime
1718

1819

1920

‎en/introduct/target.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
1. all modern Browser include mobile browsers
5-
2. ie6 - ie9 is also supported today ( it is beacuse that some product in my company need supporting ie6+, we may remove the ie6 support in future and release another version )
5+
2. ie7 - ie9 is also supported today ( it is beacuse that some product in my company need supporting ie6+, we may remove the ie6 support in future and release another version )

‎en/syntax/README.md‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ Unlike dom-based template such as [angular](https://angularjs.org/), [vuejs](vue
77
The dom-based template always rely on
88
directive(`ng-if`,`ng-repeat`), so the logic is element-based, they can't describe the structure like this:
99
```html
10-
{{#list users as user}}
11-
Hello. <b>{{user.firstName}} {{user.lastName}}</b><a href="#">DELELE</a>
12-
{{/list}}
10+
{{#if isLogin}}
11+
<a {{#if isNotFavor}} on-click={{this.favor()}} {{/if}}>Digg</a> <a on-click={{ignored = true}}>Ignore</a>
12+
{{/if}}
1313
```
1414

15+
in fact, you can use use the `logic` to controll the `directive` and `event`.
16+
17+
1518
### 2. only render the parts that really need to
1619

1720
The dom-based template like angular don't have its own parsing phase, they just put the string into the document, and walker the generated dom-node to call the __LINK__ action, so the node always have some placeholder. for example:

‎zh/README.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# regularjs指南
22

3-
> ## 中文指南目前未更新到最新版,请稍等几天或查看[英文版文档](http://leeluolee.gitbooks.io/regular-guide/en/index.html)
43

5-
regularjs是一个可以实现类似angularjs的数据绑定功能的模板引擎, 相较于其它同类的基于字符串的模板引擎比如(mustache), regularjs在compile之后数据和dom仍然保持联系, 所以也称之为'live template engine'.
4+
regularjs是一个基于字符串模板的用于创建数据驱动的组件的类库, 相较于其它同类的基于字符串的模板引擎比如(mustache), regularjs在compile之后数据和dom仍然保持联系, 所以也称之为'live template engine'.
65

76
regularjs的更高层次的目的是__规范有序(regular)__的去定义组件的业务逻辑. __基于字符串模板__的它可以创建拥有独立生命周期的组件,从而可以__无缝的与任意框架集成__.
87

‎zh/SUMMARY.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
* [前言](introduct/README.md)
44
- [API索引](introduct/index.md)
5+
- [浏览器支持](introduct/target.md)
56
* [你好 Regular](getting-start/README.md)
67
- [安装](getting-start/install.md)
78
- [快速起步](getting-start/quirk-example.md)
@@ -17,13 +18,14 @@
1718
* [核心概念](core/README.md)
1819
- [类式继承和组件定义](core/class.md)
1920
- [数据监听](core/binding.md)
21+
- [计算属性](core/computed.md)
2022
- [directive——指令](core/directive.md)
2123
- [filter——过滤器](core/filter.md)
2224
- [event——ui事件体系](core/event.md)
25+
- [animation-动画](core/animation.md)
2326
- [regular的模块化策略](core/use.md)
2427
- [简单事件发射器emitter](core/message.md)
2528
- [小节](core/review.md)
2629
* [高级特性](advanced/README.md)
2730
- [内嵌组件](advanced/component.md)
28-
- [regular的transclude](advanced/content.md)
29-
- [小节](advanced/review.md)
31+
- [regular中的transclude](advanced/content.md)

‎zh/advanced/component.md‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ regular中定义的组件是可以内嵌的, 但是这个组件必须是具名
3333

3434
1. 标签名`pager`即Pager组件指定的组件名
3535
2. 非Expression类型的属性值会作为内嵌组件的参数传入,不会建立绑定关系
36-
3. Expression的属性值会与内嵌组件建立绑定关系, 比如current相当于是绑定了
37-
```javascript
38-
this.$bind(pager, 'current', 'current')
39-
```
40-
2. `on-*`绑定一个组件方法,当内嵌组件抛出`$emit`某个自定义事件时, 将会转移到Expression制定的方法处理(注意虽然与ui事件的绑定方式类似,但是是不同的概念)
36+
3. Expression的属性值会与内嵌组件建立绑定关系
37+
4. `on-*`绑定一个组件方法,当内嵌组件抛出`$emit`某个自定义事件时, 将会转移到Expression制定的方法处理(注意虽然与ui事件的绑定方式类似,但是是不同的概念)
4138

4239

0 commit comments

Comments
 (0)