Skip to content

Commit

Permalink
change template page
Browse files Browse the repository at this point in the history
  • Loading branch information
fefit committed Aug 4, 2021
1 parent b25b08b commit f02117a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions docs/en/types/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ Such.as(":::it's a string-`:string`;it's a number-`:number`;:::{3,5}");
```


- Note: The template literal type was added in the `v1.1.0` version. This version does not support the `:ref` reference data type, but it has been repaired and supplemented in `v1.1.1`. Now, you can use a normal data path to reference data like before, and a special path like `/${0}`, `/${1}` is added to support to reference the data type used in template literal itself by index.
- Note: The template literal type was added in the `v1.1.0` version. This version does not support the `:ref` reference data type, but it has been repaired and supplemented in `v1.1.1`. Now, you can use a normal data path to reference data like before, and a special path with index number like `/${0}`, `/${1}` and a named reference like `/${name}` is added to support to reference the data type used in template literal itself by index. The named data type uses a pair of angle brackets `<>` with a wrap name, then the `:ref` data type can reference the named data type by it's wrap name.

```javascript
Such.as({
hello: 'hello',
world: 'world',
say: ':::`:ref:&./hello`,`:ref:&./world`!`:ref:&/${0}`,`:ref:&/${1}`!'
say: ':::`<say>:ref:&./hello`,`<say>:ref:&./world`!`:ref:&/${0}`,`:ref:&/${1}`!`:ref:&/${say}:@join(",")`!'
});
// will output
{
hello: 'hello',
world: 'world',
say: 'hello,world!hello,world!'
say: 'hello,world!hello,world!hello,world!'
}
```
6 changes: 3 additions & 3 deletions docs/types/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ Such.as(":::\\`\\:::"); // 将输出 "`:::"
Such.as(":::一个字符串-`:string`;一个数字`:number`;:::{3,5}");
```

- 注意:模板字符串类型是在 `v1.1.0` 版本中添加,此版本中是不支持 `:ref` 引用类型的,但在 `v1.1.1` 中进行了修复和补充,除了可以按以前的方式引用正常数据字段外,还增加了 `/${0}`, `/${1}` 这种特殊的路径来支持索引模板字符串本身用到的数据类型。
- 注意:模板字符串类型是在 `v1.1.0` 版本中添加,此版本中是不支持 `:ref` 引用类型的,但在 `v1.1.1` 中进行了修复和补充,除了可以按以前的方式引用正常数据字段外,还增加了 `/${0}`, `/${1}` 以及命名数据引用 `/${name}` 这种特殊的路径来支持索引模板字符串本身用到的数据类型。命名数据类型是在类型前以一对尖括号 `<>` 包裹一个名称的方式来声明的,如果多个命名相同,引用的类型就会得到一个按出现顺序、最终值组成的数组

```javascript
Such.as({
hello: '你好',
world: '世界',
say: ':::`:ref:&./hello`,`:ref:&./world`!`:ref:&/${0}`,`:ref:&/${1}`!'
say: ':::`<say>:ref:&./hello`,`<say>:ref:&./world`!`:ref:&/${0}`,`:ref:&/${1}`!`:ref:&/${say}:@join(",")`!'
});
// 将输出
{
hello: '你好',
world: '世界',
say: '你好,世界!你好,世界!'
say: '你好,世界!你好,世界!你好,世界!'
}
```

0 comments on commit f02117a

Please sign in to comment.