Skip to content

Commit 9d549ff

Browse files
committed
docs[plugin-action-template-print]: fix docx
1 parent faa0181 commit 9d549ff

File tree

2 files changed

+45
-148
lines changed
  • docs
    • en-US/handbook/action-template-print
    • zh-CN/handbook/action-template-print

2 files changed

+45
-148
lines changed

docs/en-US/handbook/action-template-print/index.md

Lines changed: 22 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -621,44 +621,6 @@ Model S
621621

622622
---
623623

624-
#### 9. Syntax Description: Intelligent Filtering
625-
626-
- Using intelligent condition blocks, you can hide an entire row based on complex conditions. For example:
627-
```
628-
{d.array[i].property:ifIN('keyword'):drop(row)}
629-
```
630-
631-
#### 10. Example: Intelligent Filtering
632-
633-
##### Data
634-
```json
635-
[
636-
{ "name": "Falcon 9" },
637-
{ "name": "Model S" },
638-
{ "name": "Model 3" },
639-
{ "name": "Falcon Heavy" }
640-
]
641-
```
642-
643-
##### Template
644-
```
645-
People
646-
{d[i].name}
647-
{d[i].name:ifIN('Falcon'):drop(row)}
648-
{d[i+1].name}
649-
```
650-
651-
##### Result
652-
```
653-
People
654-
Model S
655-
Model 3
656-
```
657-
658-
*(Note: Rows containing "Falcon" in the template are removed by the intelligent filtering condition.)*
659-
660-
---
661-
662624
### Deduplication
663625

664626
#### 1. Syntax Description
@@ -761,27 +723,9 @@ The output will have the specified prefix added in front of the text.
761723
### Dynamic Parameters
762724

763725
#### 1. Syntax Explanation
764-
Formatters also support dynamic parameters. These parameters start with a dot (`.`) and are not enclosed in quotes.
765-
There are two methods to specify dynamic parameters:
766-
- **Absolute JSON Path:** Begins with `d.` or `c.` (referring to root data or supplemental data).
767-
- **Relative JSON Path:** Begins with a single dot (`.`), indicating that the property is looked up from the current parent object.
768-
769-
For example:
770-
```
771-
{d.subObject.qtyB:add(d.subObject.qtyC)}
772-
```
773-
It can also be written as a relative path:
774-
```
775-
{d.subObject.qtyB:add(.qtyC)}
776-
```
777-
If you need to access data from a higher level (parent or above), you can use multiple dots:
778-
```
779-
{d.subObject.qtyB:add(..qtyA):add(.qtyC)}
780-
```
726+
NocoBase passes data to formatters if parameters start with a dot ```.``` and is not surrounded by quotes.
781727

782-
#### 2. Example
783-
784-
Data:
728+
#### 2. Data:
785729
```json
786730
{
787731
"id": 10,
@@ -797,24 +741,27 @@ Data:
797741
}
798742
```
799743

800-
Usage in Template:
744+
#### 3. Template => Result
745+
do mathematical operations:
801746
```
802-
{d.subObject.qtyB:add(d.subObject.qtyC)} // Result: 8 (5 + 3)
803-
{d.subObject.qtyB:add(.qtyC)} // Result: 8
804-
{d.subObject.qtyB:add(..qtyA):add(.qtyC)} // Result: 28 (5 + 20 + 3)
805-
{d.subArray[0].qtyE:add(..subObject.qtyC)} // Result: 6 (3 + 3)
747+
{d.subObject.qtyB:add(.qtyC)} => 8 (5+3)
748+
```
749+
read parent attributes if you use two dots, grandparents if you use three dots, etc...
750+
```
751+
{d.subObject.qtyB:add(.qtyC):add(..qtyA)} => 28 (5+3+20)
752+
```
753+
read parent objects and their children attributes (no limit in depth)
754+
```
755+
{d.subArray[i].qtyE:add(..subObject.qtyC) => 6 (3+3)
756+
```
757+
It returns an error if the attribute does not exist
758+
```
759+
{d.subArray[i].qtyE:add(..badAttr) => [[C_ERROR]] badAttr not defined
760+
```
761+
You cannot access arrays
762+
```
763+
{d.subObject.qtyB:add(..subArray[0].qtyE)} => [[C_ERROR]] subArray[0] not defined
806764
```
807-
808-
#### 3. Result
809-
810-
The examples yield 8, 8, 28, and 6 respectively.
811-
812-
> **Note:** Using custom iterators or array filters as dynamic parameters is not allowed, for example:
813-
> ```
814-
> {d.subObject.qtyB:add(..subArray[i].qtyE)}
815-
> {d.subObject.qtyB:add(d.subArray[i].qtyE)}
816-
> ```
817-
818765
---
819766

820767
### Text Formatting
@@ -1799,7 +1746,7 @@ Conditional statements allow you to dynamically control the display or hiding of
17991746
- **Inline conditions**: Directly output text (or replace it with other text).
18001747
- **Conditional blocks**: Display or hide a section of the document, suitable for multiple Template tags, paragraphs, tables, etc.
18011748

1802-
All conditions begin with a logical evaluation formatter (e.g., ifEQ, ifGT, etc.), followed by action formatters (such as show, elseShow, drop, keep, etc.).
1749+
All conditions begin with a logical evaluation formatter (e.g., ifEQ, ifGT, etc.), followed by action formatters (such as show, elseShow, etc.).
18031750

18041751
---
18051752

docs/zh-CN/handbook/action-template-print/index.md

Lines changed: 23 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -620,43 +620,6 @@ Model S
620620

621621
---
622622

623-
#### 9. 语法说明:智能筛选
624-
625-
- 通过智能条件块可根据复杂条件隐藏整行,示例格式:
626-
```
627-
{d.array[i].属性:ifIN('关键字'):drop(row)}
628-
```
629-
630-
#### 10. 示例:智能筛选
631-
632-
##### 数据
633-
```json
634-
[
635-
{ "name": "Falcon 9" },
636-
{ "name": "Model S" },
637-
{ "name": "Model 3" },
638-
{ "name": "Falcon Heavy" }
639-
]
640-
```
641-
642-
##### 模板
643-
```
644-
People
645-
{d[i].name}
646-
{d[i].name:ifIN('Falcon'):drop(row)}
647-
{d[i+1].name}
648-
```
649-
650-
##### 结果
651-
```
652-
People
653-
Model S
654-
Model 3
655-
```
656-
(注:模板中含 “Falcon” 的行被智能筛选条件删除。)
657-
658-
---
659-
660623
### 去重处理
661624

662625
#### 1. 语法说明
@@ -750,26 +713,9 @@ My name is John. I was born on January 31, 2000.
750713
### 动态参数
751714

752715
#### 1. 语法说明
753-
格式化器支持动态参数,参数以点号(.)开头且不加引号。
754-
可使用两种方式:
755-
- **绝对 JSON 路径**:以 `d.``c.` 开头(根数据或补充数据)。
756-
- **相对 JSON 路径**:以单个点(.)开头,表示从当前父级对象中查找属性。
716+
如果参数以点号```.``` 开头且未用引号括起来,NocoBase 会将数据传递给格式化程序
757717

758-
例如:
759-
```
760-
{d.subObject.qtyB:add(d.subObject.qtyC)}
761-
```
762-
也可写为相对路径:
763-
```
764-
{d.subObject.qtyB:add(.qtyC)}
765-
```
766-
若需访问上一级或更高层数据,可使用多个点:
767-
```
768-
{d.subObject.qtyB:add(..qtyA):add(.qtyC)}
769-
```
770-
771-
#### 2. 示例
772-
数据:
718+
#### 2. 数据:
773719
```json
774720
{
775721
"id": 10,
@@ -784,23 +730,28 @@ My name is John. I was born on January 31, 2000.
784730
}]
785731
}
786732
```
787-
模板中使用:
733+
734+
#### 3. 模板 => 结果
735+
进行数学运算:
788736
```
789-
{d.subObject.qtyB:add(d.subObject.qtyC)} // 结果:8 (5 + 3)
790-
{d.subObject.qtyB:add(.qtyC)} // 结果:8
791-
{d.subObject.qtyB:add(..qtyA):add(.qtyC)} // 结果:28 (5 + 20 + 3)
792-
{d.subArray[0].qtyE:add(..subObject.qtyC)} // 结果:6 (3 + 3)
737+
{d.subObject.qtyB:add(.qtyC)} => 8 (5+3)
738+
```
739+
如果使用两个点,则读取父级属性;如果使用三个点,则读取祖级属性,依此类推...
740+
```
741+
{d.subObject.qtyB:add(.qtyC):add(..qtyA)} => 28 (5+3+20)
742+
```
743+
读取父对象及其子对象的属性(深度不限)。
744+
```
745+
{d.subArray[i].qtyE:add(..subObject.qtyC) => 6 (3+3)
746+
```
747+
如果属性不存在,则返回错误。
748+
```
749+
{d.subArray[i].qtyE:add(..badAttr) => [[C_ERROR]]
750+
```
751+
无法访问数组
752+
```
753+
{d.subObject.qtyB:add(..subArray[0].qtyE)} => [[C_ERROR]] subArray[0] not defined
793754
```
794-
795-
#### 3. 结果
796-
各示例分别得到 8、8、28、6。
797-
798-
> **注意:** 使用自定义迭代器或数组过滤器作为动态参数是不允许的,如:
799-
> ```
800-
> {d.subObject.qtyB:add(..subArray[i].qtyE)}
801-
> {d.subObject.qtyB:add(d.subArray[i].qtyE)}
802-
> ```
803-
804755
---
805756

806757
### 文本格式化
@@ -1782,7 +1733,7 @@ undefined:arrayMap() // 输出 undefined
17821733
- **条件块**:对文档中一段区域进行显示或隐藏,适用于多个 标签、段落、表格等。
17831734
- **智能条件**:通过一条标签直接移除或保留目标元素(如行、段落、图片等),语法更简洁。
17841735

1785-
所有条件均以一个逻辑判断格式器开始(例如 ifEQ、ifGT 等),后续跟随执行动作的格式器(如 show、elseShow、drop、keep 等)。
1736+
所有条件均以一个逻辑判断格式器开始(例如 ifEQ、ifGT 等),后续跟随执行动作的格式器(如 show、elseShow等)。
17861737

17871738
---
17881739

@@ -1808,7 +1759,6 @@ undefined:arrayMap() // 输出 undefined
18081759
- **动作格式器**
18091760
- **:show(text) / :elseShow(text)**:用于内联条件,直接输出指定文本
18101761
- **:hideBegin / :hideEnd****:showBegin / :showEnd**:用于条件块,隐藏或显示文档块
1811-
- **:drop(element) / :keep(element)**:用于智能条件,移除或保留指定文档元素
18121762

18131763
接下来分别介绍各个用法的详细语法、示例与结果。
18141764

0 commit comments

Comments
 (0)