;doc:csv: How CSV rules are evaluated: clarify

This commit is contained in:
Simon Michael 2025-04-16 10:32:50 -10:00
parent bcc8471966
commit ee3bd28711

View File

@ -4251,13 +4251,13 @@ if something
Here's how to think of CSV rules being evaluated: Here's how to think of CSV rules being evaluated:
1. All `include`d rules files are inlined, from top to bottom, depth first 1. Any `include`d rules files are inlined, from top to bottom, depth first
(scanning each included file for further includes recursively before proceeding). (scanning each included file for further includes recursively before proceeding).
2. Top level rules (`date-format`, `fields`, `newest-first`, `skip` at top level, etc) are processed, top to bottom. 2. Top level rules (`date-format`, `fields`, `newest-first`, `skip` at top level, etc) are processed, top to bottom.
With most rules, if it is seen more than once, the last/bottom-most wins. With most rules, if it is seen more than once, the last/bottom-most wins.
But with `skip`/`end` rules, the first/top-most wins. But with `skip`/`end` rules, the first/top-most wins.
`skip [N]` immediately skips the current or the next N CSV records. `skip [N]` immediately skips the current or next N CSV records.
`end` immediately skips all remaining CSV records. `end` immediately skips all remaining CSV records.
3. For each CSV record in turn: 3. For each CSV record in turn:
@ -4265,7 +4265,7 @@ Here's how to think of CSV rules being evaluated:
a. Search the `if` blocks, from top to bottom, for a succeeding one containing a `skip` or `end` rule. a. Search the `if` blocks, from top to bottom, for a succeeding one containing a `skip` or `end` rule.
If found, immediately skip the specified number of CSV records. If found, immediately skip the specified number of CSV records.
b. Otherwise, compute hledger field values. b. Otherwise, compute hledger field values for this record.
For each hledger field (`date`, `description`, `account1`, etc.): For each hledger field (`date`, `description`, `account1`, etc.):
- Collect all assignments to this field, whether - Collect all assignments to this field, whether