You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bkpr-report: enhance tag syntax from {tag:replacement} to {tag?if-set:if-not-set}
This is more powerful, but we need to do this before release. It lets
us do things like: {credit?+{credit}:0} to only put a `+` in front of
no-zero credit, and {txid?TXID {txid}:Outpoint {outpoint}} to print
either `TXID xxx` or `Outpoint xxx`.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: contrib/msggen/msggen/schema.json
+9-8Lines changed: 9 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -5160,15 +5160,16 @@
5160
5160
"{currencydebit}: debit amount converted into bkpr-currency",
5161
5161
"{currencycreditdebit}: +credit or -debit (or 0) in bkpr-currency",
5162
5162
"",
5163
-
"If a field is unavailable, it expands to an empty string.",
5163
+
"If a field is unavailable, it expands to an empty string (or 0 for credit, debit, fees and creditdebit).",
5164
5164
"",
5165
-
"You can provide fallback with ?, which is used when the tag is not present (or zero, for credit, debit, fees and creditdebit). This fallback can include more tags:",
5166
-
" * {outpoint?NONE}",
5167
-
" * {payment_id?txid: {txid?UNKNOWN}}",
5168
-
"The first one the outpoint, or NONE if that is not available. ",
5169
-
"The second prints the payment_id, or if that is not available, the string 'txid: ' followed by the txid, or if that is not available, 'txid: UNKNOWN'.",
5170
-
"",
5171
-
"The text after ? is used only if that tag would otherwise be empty.",
5165
+
"Tags support C-style conditional syntax: {tag[?if-set][:if-not-set]}",
5166
+
" * if-set: text to use when the tag is present (and non-zero for credit, debit, fees and creditdebit). Default is the tag value itself.",
5167
+
" * if-not-set: text to use when the tag is absent (or zero for amount fields). Default is empty string (or 0 for amount fields).",
5168
+
"Either or both parts may be omitted, and each part can itself contain tags. For example:",
5169
+
" * {outpoint:NONE}: the outpoint value, or 'NONE' if not available",
5170
+
" * {credit:0.00}: the credit value, or '0.00' if zero",
5171
+
" * {outpoint?[{outpoint}]:NONE}: '[<value>]' if outpoint is available, or 'NONE' if not",
5172
+
" * {payment_id:{txid:UNKNOWN}}: the payment_id, or the txid if no payment_id, or 'UNKNOWN' if neither",
Copy file name to clipboardExpand all lines: doc/schemas/bkpr-report.json
+9-8Lines changed: 9 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -46,15 +46,16 @@
46
46
"{currencydebit}: debit amount converted into bkpr-currency",
47
47
"{currencycreditdebit}: +credit or -debit (or 0) in bkpr-currency",
48
48
"",
49
-
"If a field is unavailable, it expands to an empty string.",
49
+
"If a field is unavailable, it expands to an empty string (or 0 for credit, debit, fees and creditdebit).",
50
50
"",
51
-
"You can provide fallback with ?, which is used when the tag is not present (or zero, for credit, debit, fees and creditdebit). This fallback can include more tags:",
52
-
" * {outpoint?NONE}",
53
-
" * {payment_id?txid: {txid?UNKNOWN}}",
54
-
"The first one the outpoint, or NONE if that is not available. ",
55
-
"The second prints the payment_id, or if that is not available, the string 'txid: ' followed by the txid, or if that is not available, 'txid: UNKNOWN'.",
56
-
"",
57
-
"The text after ? is used only if that tag would otherwise be empty.",
51
+
"Tags support C-style conditional syntax: {tag[?if-set][:if-not-set]}",
52
+
" * if-set: text to use when the tag is present (and non-zero for credit, debit, fees and creditdebit). Default is the tag value itself.",
53
+
" * if-not-set: text to use when the tag is absent (or zero for amount fields). Default is empty string (or 0 for amount fields).",
54
+
"Either or both parts may be omitted, and each part can itself contain tags. For example:",
55
+
" * {outpoint:NONE}: the outpoint value, or 'NONE' if not available",
56
+
" * {credit:0.00}: the credit value, or '0.00' if zero",
57
+
" * {outpoint?[{outpoint}]:NONE}: '[<value>]' if outpoint is available, or 'NONE' if not",
58
+
" * {payment_id:{txid:UNKNOWN}}: the payment_id, or the txid if no payment_id, or 'UNKNOWN' if neither",
0 commit comments