Skip to content

Commit 002f3b9

Browse files
authored
Merge pull request #3 from IntentFile/docs/print-row-filtering
docs(spec): print-template row filtering (filter/match)
2 parents cf31ed3 + c2b216f commit 002f3b9

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

docs/spec/presentation.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,29 @@ The template is a tree of layout tags (`page`, `header` / `footer`, `section` /
158158
{{<Property>}} a line-item field (inside a table bound to the items)
159159
```
160160

161+
A `table` (or a row-expanding `for`) can **filter** the collection it renders — a declarative value match, never an expression: `filter="<path>"` keeps the rows whose path (resolved per row) is truthy, and adding `match="A | B"` keeps only the rows whose value equals one of the `|`-separated literals. The same `match` on an `if` compares its resolved `source` against the listed values instead of testing truthiness. One bound collection can this way render into several purpose-grouped tables — the two-column payslip (earnings left, deductions right), a journal entry's debit and credit sides, a VAT summary per rate:
162+
163+
```text
164+
<row gap="16">
165+
<stack>
166+
<text style="subtitle">Earnings</text>
167+
<table source="items" filter="Kind" match="BASE | ENTRY">
168+
<column width="3*" label="Earning">{{Name}}</column>
169+
<column width="*" align="right" label="Amount">{{Amount}}</column>
170+
</table>
171+
</stack>
172+
<stack>
173+
<text style="subtitle">Deductions</text>
174+
<table source="items" filter="Kind" match="CONTRIBUTION | TAX">
175+
<column width="3*" label="Deduction">{{Name}}</column>
176+
<column width="*" align="right" label="Amount">{{Amount}}</column>
177+
</table>
178+
</stack>
179+
</row>
180+
```
181+
182+
A generator that predates the attributes ignores them and renders all rows — a filtered template never fails on an older platform.
183+
161184
::: info Normative
162185
The print template is written **create-if-absent** and never regenerated over. A printed document is a formatted, audited artefact you adapt by hand, and a newly added model field must not silently appear on an already-designed document.
163186
:::

0 commit comments

Comments
 (0)