;doc:csv:if table: clarify, explain why backslash won't work (#2107)

This commit is contained in:
Simon Michael 2023-11-21 12:01:28 -10:00
parent 32d9deb3e1
commit ef2f3e1607

View File

@ -3355,15 +3355,18 @@ MATCHERC,VALUE1,VALUE2,...
<empty line> <empty line>
``` ```
The first character after `if` is taken to be the separator for the rest of the table. The first character after `if` is taken to be this if table's field separator.
It should be a non-alphanumeric character like `,` or `|` that does not appear anywhere else in the table. It is unrelated to the separator used in the CSV file.
(Note: it is unrelated to the CSV file's separator.) It should be a non-alphanumeric character like `,` or `|` that does not appear anywhere else in the table
Whitespace can be used in the matcher lines for readability, but not in the if line currently. (it should not be used in field names or matchers or values, and it cannot be escaped with a backslash).
The table must be terminated by an empty line (or end of file).
Each line must contain the same number of separators; empty values are allowed.
The above means: try all of the matchers; whenever a matcher succeeds, Each line must contain the same number of separators; empty values are allowed.
assign all of the values on that line to the corresponding hledger fields; Whitespace can be used in the matcher lines for readability (but not in the if line, currently).
The table must be terminated by an empty line (or end of file).
An if table like the above is interpreted as follows:
try all of the matchers;
whenever a matcher succeeds, assign all of the values on that line to the corresponding hledger fields;
later lines can overrider earlier ones. later lines can overrider earlier ones.
It is equivalent to this sequence of if blocks: It is equivalent to this sequence of if blocks: