Skip to content

Commit b14e00d

Browse files
committed
docs: update automation documents
Signed-off-by: peefy <[email protected]>
1 parent 521ba1a commit b14e00d

File tree

8 files changed

+110
-0
lines changed

8 files changed

+110
-0
lines changed

docs/user_docs/guides/automation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ app: App {
128128
}
129129
```
130130

131+
Note that when `name` of `app` is not in the `App` schema config, it will be added into the config after override.
132+
131133
#### Delete Configuration
132134

133135
Run the command to delete the `key` attribute of `labels`.

i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/automation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ app: App {
128128
}
129129
```
130130

131+
注意当配置块中 `app` 的 `name` 属性不存在时, 它会被新增到配置块中。
132+
131133
#### 删除配置
132134

133135
执行如下命令可以删除 `labels` 中的 `key` 字段

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.8/reference/model/overview.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,7 @@ KCL 通过内置模块、系统库模块和插件模块提供工程化的扩展
5454
<DocsCard header="file" href="file">
5555
<p>提供了与文件系统相关的函数。</p>
5656
</DocsCard>
57+
<DocsCard header="template" href="template">
58+
<p>提供了与模版相关的函数。</p>
59+
</DocsCard>
5760
</DocsCards>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: "template"
3+
linkTitle: "template"
4+
type: "docs"
5+
description: 模版操作
6+
weight: 100
7+
---
8+
9+
## execute
10+
11+
`execute(template: str, data: {str:any} = {}) -> str`
12+
13+
将解析过的模板应用于指定的数据对象,并返回字符串输出。查看 https://handlebarsjs.com/ 获取更多文档和示例。
14+
15+
```python3
16+
import template
17+
18+
content = template.execute("""\
19+
<div class="entry">
20+
{{#if author}}
21+
<h1>{{firstName}} {{lastName}}</h1>
22+
{{/if}}
23+
</div>
24+
""", {
25+
author: True,
26+
firstName: "Yehuda",
27+
lastName: "Katz",
28+
})
29+
```
30+
31+
## html_escape
32+
33+
`html_escape(data: str) -> str`
34+
35+
将字符 `&"<>` 替换为等效的 html / xml实体。
36+
37+
```python3
38+
39+
import template
40+
41+
content = template.html_escape("""\
42+
<div class="entry">
43+
{{#if author}}
44+
<h1>{{firstName}} {{lastName}}</h1>
45+
{{/if}}
46+
</div>
47+
""")
48+
```

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.8/user_docs/guides/automation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ app: App {
128128
}
129129
```
130130

131+
注意当配置块中 `app` 的 `name` 属性不存在时, 它会被新增到配置块中。
132+
131133
#### 删除配置
132134

133135
执行如下命令可以删除 `labels` 中的 `key` 字段

versioned_docs/version-0.8/reference/model/overview.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,7 @@ For relatively complex general logic, it is provided through the system modules.
5454
<DocsCard header="file" href="file">
5555
<p>Provides filesystem functions.</p>
5656
</DocsCard>
57+
<DocsCard header="template" href="template">
58+
<p>Provides template functions.</p>
59+
</DocsCard>
5760
</DocsCards>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: "template"
3+
linkTitle: "template"
4+
type: "docs"
5+
description: template functions
6+
weight: 100
7+
---
8+
9+
## execute
10+
11+
`execute(template: str, data: {str:any} = {}) -> str`
12+
13+
Applies a parsed template to the specified data object and returns the string output. See https://handlebarsjs.com/ for more documents and examples.
14+
15+
```python3
16+
import template
17+
18+
content = template.execute("""\
19+
<div class="entry">
20+
{{#if author}}
21+
<h1>{{firstName}} {{lastName}}</h1>
22+
{{/if}}
23+
</div>
24+
""", {
25+
author: True,
26+
firstName: "Yehuda",
27+
lastName: "Katz",
28+
})
29+
```
30+
31+
## html_escape
32+
33+
`html_escape(data: str) -> str`
34+
35+
Replaces the characters `&"<>` with the equivalent html / xml entities.
36+
37+
```python3
38+
39+
import template
40+
41+
content = template.html_escape("""\
42+
<div class="entry">
43+
{{#if author}}
44+
<h1>{{firstName}} {{lastName}}</h1>
45+
{{/if}}
46+
</div>
47+
""")
48+
```

versioned_docs/version-0.8/user_docs/guides/automation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ app: App {
128128
}
129129
```
130130

131+
Note that when `name` of `app` is not in the `App` schema config, it will be added into the config after override.
132+
131133
#### Delete Configuration
132134

133135
Run the command to delete the `key` attribute of `labels`.

0 commit comments

Comments
 (0)