Numbering Clauses and Cross-Referencing Them
Once a wiki drops clauses that do not apply, hand-typed numbering breaks. A will that skips the guardianship clause should not jump from 4 to 6, and a sentence reading "as set out in clause 7" should not point at whatever clause 7 happens to be this time.
Automatic numbering solves both. You mark clauses instead of numbering them, and the numbers are worked out after the logic has decided what survives.
Table of Contents
- Numbering Clauses
- Sub-Clauses
- Naming a Clause
- Cross-Referencing
- Why It Survives Dropped Clauses
- Common Mistakes
Numbering Clauses
Write {#clause} where the number should appear:
{#clause}. REVOCATION OF PRIOR WILLS
{#clause}. APPOINTMENT OF EXECUTOR
{#clause}. BEQUESTSrenders as
1. REVOCATION OF PRIOR WILLS
2. APPOINTMENT OF EXECUTOR
3. BEQUESTSYou never type the number. Add a clause in the middle, remove one, or wrap one in a condition – everything after it renumbers itself.
Sub-Clauses
Add a depth to number beneath the current clause:
| Token | Produces | Resets when |
|---|---|---|
{#clause} | 1, 2, 3 | Never |
{#clause.2} | 1.1, 1.2, 2.1 | A new {#clause} starts |
{#clause.3} | 1.1.1, 1.1.2 | A new {#clause} or {#clause.2} starts |
{#clause}. BEQUESTS
{#clause.2}. My immovable property shall pass to my spouse.
{#clause.2}. My motor vehicles shall be sold.
{#clause}. RESIDUE4. BEQUESTS
4.1. My immovable property shall pass to my spouse.
4.2. My motor vehicles shall be sold.
5. RESIDUENaming a Clause
To point at a clause from elsewhere, give it a name by adding a colon:
{#clause:residue}. RESIDUE OF THE ESTATEThat still numbers normally – the name is a label for referring to it, and never appears in the document. Names work at any depth: {#clause.2:trust-terms} is fine.
Use short, descriptive names in lower case with hyphens. A name must be unique within the wiki.
Cross-Referencing
Refer to a named clause with {@name}. It renders that clause's number, whatever it turns out to be:
The residue of my estate shall devolve as set out in clause {@residue}.renders as
The residue of my estate shall devolve as set out in clause 7.You may reference a clause before or after the point where it is defined – the numbers are resolved once the whole document is assembled.
Why It Survives Dropped Clauses
Numbering happens after conditions and loops have run. Only clauses that actually appear are counted.
{#clause:executor}. APPOINTMENT OF EXECUTOR
{IF:minor_count>0}
{#clause:guardian}. APPOINTMENT OF GUARDIAN
{/IF}
{#clause:residue}. RESIDUE
Refer to clause {@residue} for the distribution.With minor children, the residue clause is 3 and the sentence reads "clause 3". Without them, the guardianship clause never renders – the residue clause becomes 2, and the sentence reads "clause 2". Nothing had to be adjusted.
Note: Clauses produced inside a loop are numbered as they are emitted, so a bequest clause repeated for five assets takes five consecutive numbers.
Common Mistakes
| Symptom | Usual cause |
|---|---|
{@name} appears as text in the PDF | No clause carries that name. Check the spelling – the sidebar suggests the closest match. |
| Two clauses share a number | The same name was used twice. Names must be unique. |
| Sub-clause numbering restarts unexpectedly | A {#clause} between them started a new top-level clause. |
| The reference points at the wrong clause | The name is on a different clause from the one intended – names attach to the clause marker they are written on. |
| A named clause is flagged as unreferenced | Information only. It is fine to name a clause you have not pointed at yet. |
Next: Show or Hide Parts of a Document · back to Wiki Logic.